#include <iostream>
#include <cstdio>
using namespace std;

#define MAXSIZE 100

typedef int Status;
typedef int Elem;

typedef struct sqStack
{
int len;
Elem *base;
Elem *top;
}sqStack;

Status InitStack(sqStack &s)
{
s.base = new Elem[MAXSIZE];
if (!s.base) return 0;

s.top = s.base;
s.len = MAXSIZE;

return 1;
}

Status Push(sqStack &s,Elem e)
{
if (s.top - s.base == s.len) return 0; //满
else *s.top++ = e;

return 1;
}

Status Pop(sqStack &s, Elem &e)
{
if (s.top == s.base) return 0; //空
else e = *--s.top;

return 1;
}

Status GetTop(sqStack &s)
{
if (s.top != s.base)
return *(s.top - 1); //满意的写法 *了

else return 0;
}

int main()
{
sqStack s;
//1
InitStack(s);

//1
Push(s,1);

//1
cout << GetTop(s);

//1
Elem e;
Pop(s, e);

cout << e;
}