#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
#define MaxSize 100
//顺序栈
typedef int dataType;
typedef struct{
dataType data[MaxSize];
int top;
}SeqStack;
//创建顺序栈
SeqStack* createStack(){
SeqStack *t=(SeqStack *)malloc(sizeof(SeqStack));
t->top=-1;
return t;
}
//判断栈是否为空
int empty(SeqStack *s){
return s->top==-1;
}
//判断栈是否满
int full(SeqStack *s){
return s->top==MaxSize-1;
}
//元素x进栈
void push(SeqStack *s,dataType x){
if(full(s)) exit(1);
s->data[++s->top]=x; //指针先加1,再入栈
}
//出栈
void pop(SeqStack *s){
if(empty(s)) exit(1);
s->top--; //先出栈,指针再减1
}
//取栈顶元素的值
dataType top(Seq