为啥我写了好久堆栈总是空啊!!!! 可以有大佬帮帮我吗? #include<stdio.h> #include<stdlib.h> #define STACK_INIT_SIZE 100 #define STACKINCREMENT 10 #define OVERFLOW 0 typedef char Elemtype; typedef struct LNode{ Elemtype base; Elemtype top; int stacksize;}SqStack; int InitStack(SqStack &S); int InitStack(SqStack &S){ S.base=(Elemtype)malloc(STACK_INIT_SIZEsizeof(Elemtype)); if(!S.base)exit(OVERFLOW); S.top=S.base; S.stacksize=STACK_INIT_SIZE; return 1;} int Gettop(SqStack S,Elemtype &e); int Gettop(SqStack S,Elemtype &e){ if(S.topS.base) return 0; e=*(S.top-1); return 1;} int StackEmpty(SqStack S); int StackEmpty(SqStack S){ if(S.topS.base) { printf(“NULL\n”); return 1;} else return 0;} int Push(SqStack S,char e); int Push(SqStack S,char e){ int i; if(S.top-S.base>=S.stacksize) { S.base=(Elemtype*)realloc(S.base,(S.stacksize+STACKINCREMENT)*sizeof(Elemtype)); if(!S.base)exit(OVERFLOW); S.top=S.base+S.stacksize; S.stacksize+=STACKINCREMENT;} *S.top++=e; return 1;} int Pop(SqStack &S, Elemtype &e) { if(S.top == S.base) return 0; e = *–S.top; return 1;}int StackLength(SqStack S); int StackLength(SqStack S) { int i=0; while (!StackEmpty(S)) { i++; } return i;} int main() { SqStack S; int n; char e; InitStack(S); StackEmpty(S); printf(“请输入数据以0为结尾的数据:\n”); char num; scanf("%c",&num); while(num!=‘0’) { if(num!=’ ') Push(S,num); scanf("%c",&num); } Gettop(S,e); StackEmpty(S); StackLength(S); while (!StackEmpty(S)) { Pop(S,e); printf("%c ",e); } return 0; }