目录
1.引入头文件
#include<stdio.h>
#include<stdlib.h>
2.宏定义
#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10
3.存储结构
typedef struct{
int *top;
int *base;
int stacksize;
}SqStack;
4.函数定义
4.1 建栈
//建栈
bool InitStack(SqStack &S){
S.base = (int*)malloc(STACK_INIT_SIZE*sizeof(int));
if(!S.base)
return false;
S.top = S.base;
S.stacksize = STACK_INIT_SIZE;
return true;
}
4.2 查栈顶
//查栈顶
bool GetTop(SqStack S,int &e){