#pragma once//LinkStack.h
#include<iostream>
using namespace std;
typedef char DataType;
typedef struct node
{
DataType data;
struct node *next;
}LStackNode, *LinkStack;
void InitStack(LinkStack *top)
{
LStackNode *p = new LStackNode;
p->next = NULL;
(*top) = p;
}
int StackEmpty(LinkStack top)
{
if (top->next == NULL)
return 1;
else
return 0;
}
int PushStack(LinkStack &top, DataType e)
{
LStackNode *p = new LStackNode;
if (!p)
exit(1);
p->data = e;
p->next = top->next;
top->next = p;
return 1;
}
int PopStack(LinkStack top, DataType *e)
{
LStackNode *p =
#include<iostream>
using namespace std;
typedef char DataType;
typedef struct node
{
DataType data;
struct node *next;
}LStackNode, *LinkStack;
void InitStack(LinkStack *top)
{
LStackNode *p = new LStackNode;
p->next = NULL;
(*top) = p;
}
int StackEmpty(LinkStack top)
{
if (top->next == NULL)
return 1;
else
return 0;
}
int PushStack(LinkStack &top, DataType e)
{
LStackNode *p = new LStackNode;
if (!p)
exit(1);
p->data = e;
p->next = top->next;
top->next = p;
return 1;
}
int PopStack(LinkStack top, DataType *e)
{
LStackNode *p =