#defin maxsize 1024typedef struct{ datatype data[maxsize]; int top;}seqstack;void SETNULL(seqstack *s)//置空栈{ s->top=-1;}void PUSH(seqstack *s,datatype x)//元素入栈{ if(s->top==maxsize-1) { printf("overflow"); } else { s->top++; s->data[s->top]=x; }}int EMPTY(seqstack *s)//判断栈空{ if(s->top>=0)return 0; else return 1;}int FULL(seqstack *s)//判断栈满{ if(s->top==maxsize-1)return 1; else return 0;}datatype POP(seqstack *s)//出栈,并返回当前栈顶元素{ if(EMPTY(s)) {printf("underflow");} else { s->top--; return s->data[s->top]; }}datatype TOP(seqstack *s)//返回栈顶元素{ if(EMPTY(s)) { printf("stack is empty");return NULL; } else return (s->data[s->top]);}