#include"iostream"
using namespace std;
#define OK 1
#define ERROR 0
typedef struct StackNode
{
int data;
struct StackNode *next;
}StackNode,*LinkStack;
int InitStack(LinkStack &s)
{
s = NULL;
return OK;
}
int Push(LinkStack &s,int e)
{
LinkStack p;
p = new StackNode;
p->data = e;
p->next = s;
s = p;
return OK;
}
int Pop(LinkStack &s)
{
if (s == NULL)
return ERROR;
cout << s->data << endl;
LinkStack p;
p = s;
s = s->next;
delete p;
return OK;
}
int main()
{
int n;
LinkStack s;
InitStack(s);
cout << "链栈中有多少元素" << endl;
cin >> n;
for (int i = 0; i < n; i++)
{
int e;
cin >> e;
Push(s, e);
}
Pop(s);
system("pause");
return 0;
}