这两句代码是什么意思
电脑帮帮手 2009-03-19 10:27:36
下面是一个栈的删除元素的一个算法 红色部分代码我不是很懂,能不能给我详细点 把它分解一下 好让我能看明白
#define STACK_INIT_SIZE 100 //存储空间初始分配量
#define ATACKINCREMENT 10 // 存储空间分配增量
typedef struct
{
SElemType *base; //栈底指针
SElemType *top; //栈顶指针
int stacksize;
} SqStack;
Status initstack(SqStack &s);
status gettop(SqStack s ,SElemType &e);//用e来返回栈顶元素
status pop (SqStack &S,SElemType &e); //删除s的栈顶元素
status intstack (SqStack &s)
{
s.base=(SElemType *) malloc (STACK_INIT_SIZE*sizeof(SElemType));
if(!s.base)exit (overlow);
s.top=s.base;
s.stacksize=STACK_INIT_SIZE;
return ok;
}
status gettop (SqStack s ,SElemType &e)
{
if (!s.top==s.base) return error;
e=*(s.top-1);
}
status pop (SqStack &S,SElemType &e)
{
if (s.top==s.base) return error;
e=*--s.top;
}