bianyiqi
问题:字符串的进栈,出栈函数是这样写的吗,但好像还是有点问题?typedef struct {
char data[20];
char top;
} ag_stack;
void ag_init_stack(ag_stack *st)
{
st->top=0;
}
void ag_state_push(ag_stack *st,char *s)
{
if(st->top==MAX-1)
{ printf("\nstack is full!"); getch();exit(0); }
strcpy(st->data[st->top],s);
printf("\naaaaaa");
st->top++;
}
void ag_state_pop(ag_stack *st)
{
if(st->top==0)
{ printf("\nstack is empty!"); getch();exit(0);}
st->top--;
}