#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 20
#define ERROR 0
#defien OK 1
typedef int ElemType;
typedef int Status;
typedef struct
{
ElemType data[MAXSIZE];
int top;
}SqStack;
Status Push(SqStack *s,ElemType e)
{
if(s->top==MAXSIZE-1)
{
return ERROR;
}
s->top++;
s->data[s->top]=e;
return OK;
}
Status Pop(SqStack *s,ElemType *e)
{
if(s->top==-1)
{
return ERROR;
}
*e=s->data[s->top];
s->top--;
return OK;
}
int main()
{
printf("Hello world!\n");
return 0;
}
栈的顺序存储结构
最新推荐文章于 2022-05-11 00:58:27 发布