顺序栈出问题了……
#define MAXSIZE 100typedef struct SqStack
{
int elem[MAXSIZE];
int top;
}*S;
int SqStackpush(S s,int e)
{
if(s->top==MAXSIZE-1)
{
printf("栈满溢出");
return 0;
}
else
{s->top++;
s->elem[s->top]=e;
}
}
int SqStackEmpty(S s)
{if(s->top==0)
return 0;
else
return 1;
}
int SqStackpop(S s,int a)
{
a=s->elem[s->top];
s->top--;
return a;
}
main()
{S s;
int a;
scanf("%d",&a);
while(a!=0)
{
SqStackpush(s,a);
scanf("%d",&a);
}
while(SqStackEmpty(s))
{
SqStackpop(s,a);
printf("%d",a);
}
}