#include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
typedef int ElemType;
//定义链栈结点类型
typedef struct node
{
ElemType data;
struct node *next;
}StackNode,*LinkStack;
void InitStack(LinkStack *top)
{
*top=(LinkStack)malloc(sizeof(StackNode));
(*top)->next = NULL;
}
int Push(LinkStack top, ElemType x)
{
StackNode *NewNode;
NewNode=(StackNode*)malloc(sizeof(StackNode));
if(NewNode==NULL)
return (FALSE);
else
{
NewNode->data=x;
NewNode->next=*top->next;
*top->next=NewNode;
return (TRUE);
}
}