c语言和数据结构中SqStack 、 SqStack &S 、if(!(S.base=(SElemType *)malloc(STACK_INIT_SIZ
敖elf鸿 2011-04-12 12:10:32 SElemType *top、(SqStack &S)、if(!(S.base=(SElemType *)malloc(STACK_INIT_SIZE*sizeof(SElemType))))
这三句分别是什么意思,谁能给咱详细讲解一下,拜谢!
struct SqStack
{
SElemType *base; // 在栈构造之前和销毁之后,base的值为NULL
SElemType *top; // 栈顶指针
int stacksize; // 当前已分配的存储空间,以元素为单位
}; // 顺序栈
中,SElemType是什么东西?是类型吗?
3、
void InitStack(SqStack &S)
{ // 构造一个空栈S
if(!(S.base=(SElemType *)malloc(STACK_INIT_SIZE*sizeof(SElemType))))
exit(OVERFLOW); // 存储分配失败
S.top=S.base;
S.stacksize=STACK_INIT_SIZE;
}