顺序栈与循环队列
顺序栈
栈:先进后出的数据结构。在编译器中有广泛应用。
- 结构体
typedef struct stack{
int top;
int data[MaxSize];
}Stack;
- 创建栈
Stack *createStack(){
//创建栈
Stack *s = (Stack*)malloc(sizeof(Stack));
if(s == NULL){
return NULL;
}
s->top = -1;
return s;
}
- 判断栈是否为满栈
bool Full(Stack *s){
//判断栈是否为满栈
if(s->top == MaxSize-1){
return true;
}else{
return false;
}