#include <iostream>
#include <cstdio>
using namespace std;
typedef int Status;
typedef int Elem;
typedef struct StackNode
{
Elem data;
struct StackNode *next;
}StackNode, *LinkStack;
Status InitStack(LinkStack &S)
{
S = NULL;
return 1;
}
Status Push(LinkStack &S, Elem e)
{
StackNode *p = new StackNode;
p->data = e;
p->next = S;
S = p;
return 1;
}
Status Pop(LinkStack &S, Elem &e)
{
if (S == NULL) return -1;
e = S->data;
StackNode *p = S;
S = S->next;
delete p;
return 1;
}
Status GetTop(LinkStack &S)
{
if (S)
return S->data;
else return -1;
}
int main()
{
LinkStack S;
InitStack(S);
Push(S, 1);
cout<<GetTop(S);
int tmp;
Pop(S, tmp);
cout<<GetTop(S);
}