#ifndef _STACK_H_ #define _STACK_H_ #define ERROR 0 #define OK 1 #define TRUE 1 #define FALSE 0 #define STACK_INIT_SIZE 100 //栈存储空间初始分配量 #define SATCKINCREMENT 10 //栈存储空间增量 typedef int SElemType; typedef int Status; typedef struct{ SElemType *base; //基指针,在栈构造之前和销毁之后,base的值为NULL SElemType *top; //栈顶指针 int stacksize; //当前栈的最大容量,以元素为单位 }SqStack; Status InitStack_S(SqStack &S); Status DestoryStack_S(SqStack &S); Status ClearStack_S(SqStack &S); Status StackEmpty_S(SqStack &S); Status StackLength_S(SqStack S); Status GetTop_S(SqStack S,SElemType &e); Status Push_S(SqStack &S,SElemType e); Status visit_display_S(SElemType e); Status StackTraverse_S(SqStack &S,Status (*visit)(SElemType)); #endif