双向栈类型定义如下:
typedef struct {
SElemType *elem;
int top[2];
int size; // 分配给elem的总容量
}TwoWayStack; // 双端栈
//初始化
Status InitStack(TwoWayStack &tws, int size)
{
tws.elem=(SElemType*)malloc(sizeof(SElemType)*size); //申请空间
tws.size=size;
tws.top[0]=0;
tws.top[1]=