[求助]我的这个程序有错误请朋友们来帮个忙好吗?
假设初始值为空的栈中依次插入元素a1,a2,a3........an后,删除这些元素的次序是an,an-1,......,a2,a1,出栈并输出.
#include<stdio.h> #define max 10 typedef struct { char stack [max]; int top; } qstype; void initate q_stype (struct q_stype *s) { s->top=-1;} int push (q_stype *s,int x) { if (s->top==max-1) return(0); else { s->top++; s->stack[s->top]=x; return(1);} } main() { int ch,sign; q_stype *s; initcate q->(s); printf(">"); scanf("god",ch); while (ch!=-1) if (sign=push { printf("overflon\n"); break; } else scanf ("god",ch); while (s->top!=-1) { s->top--; printf("stack=%d\n",s->stack[s->top+1];} printf("\n");}