顺序栈
typedef struct { int elem[MAXN]; int top; }SeqStack; void InitStack(SeqStack *S) { S->top=-1; } void Push(SeqStack *S ,int x) //栈的首元素下标是0 { if(S->top==MAXN-1) //栈已满 return; S->top++; S->elem[S->top]=x; return; } void Pop(SeqStack *S ) { if(S->top==-1) //栈为空 return; else { S->top--; return; } } int GetTop(SeqStack *S ) { int x; if(S->top==-1) //栈为空 return -10000; else { x=S->elem[S->top]; } return x; }