#include<stdio.h>
#define MAXN    20//初始顺序栈的空间为20
typedef int    SElemType;
typedef int Status;
typedef struct SqStack{
    char    stack[MAXN];//假设栈的数据结构为char
    int    top = -1;//初始化栈顶指针,以0为结束符
}SqStack;
SqStack a;
Status push(char temp)
{
    if (a.top == MAXN)
    {
        printf("栈满了别来了\n");
        return 0;
    }
    else
    {
        a.top++;
        a.stack[a.top] = temp;
        return 1;
    }
}
char pop()
{
    if (a.top == -1)
    {
        return 0;
    }
    else
    {
        char temp = a.stack[a.top];//获取当前头指向的位置
        a.top--;//头下移
        return temp;//返回
    }
}
void test()
{
    char a[5];
    //入栈
    for (int i = 0; i < 5; i++)
    {
        a[i] = i + 80;
        push(a[i]);
        printf("%c", a[i]);
    }
    printf("\n");
    //出栈
    for (int i = 0; i < 5; i++)
    {
        a[i] = pop();
        printf("%c", a[i]);
    }
}
int main()
{
    test();
    return 0;
}