#include <stdio.h>
#define max 26
char stack[max];
int top=0;
int push(char x)
{
if(top>=max)
return 1;
stack[top++]=x;
return 0;
}
int pop()
{
if(top==0)
return 1;
top=top-1;
return 0;
}
int main()
{
push('a');
push('b');
push('c');
push('d');
pop();
int i=top-1;//注意要令i=top-1,因为每次入栈后,top都会指向栈顶之上的那个元素
while(i>=0)
{
printf("%c ",stack[i--]);
}
}