Status InitStack(SqStack **S). Status DestroyStack(SqStack *S). Status ClearStack(SqStack *S). Status StackEmpty(SqStack S). int StackLength(SqStack S). Status GetTop(SqStack S,SElemType *e). Status Push(SqStack *S,SElemType e). Status Pop(SqStack *S,SElemType *e). Status StackTraverse(SqStack S,Status (*visit)()).
Status InitStack(SqStack **S) { (*S)=(SqStack *) malloc(sizeof(SqStack)). (*S)->base=(SElemType *)malloc(STACK_INIT_SIZE *sizeof(SElemType)). if(!(*S)->base)exit(OVERFLOW). (*S)->top=(*S)->base. (*S)->stacksize=STACK_INIT_SIZE. return OK. }
Status DestroyStack(SqStack *S) { free(S->base). free(S). }