1.status.h文件
#ifndef STATUS_H
#define STATUS_H
//函数结果状态代码
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
//Status是函数的类型,其值是函数结果状态代码
typedef int Status;
typedef char SElemType;
typedef int ElemType;
#endif
2.ZhanLianShi.h
#ifndef ZHANLIANSHI_H
#define ZHANLIANSHI_H
#include "status.h"
typedef struct StackNode{//这里设置链栈的结点结构
//每个结点包含一个数据域和一个指针域
SElemType data;
struct StackNode *next;
}StackNode,*pNode;//*pNode是结点的结构体指针
typedef struct LinkStack{//这里设置栈顶指针
pNode top;
int count;
}LinkStack;
//函数声明
void InitStack(LinkStack *ST);
void Insert(LinkStack *ST,SElemType e);
int Pop(LinkStack *ST,SElemType *e);
int Print(LinkStack *ST);
#endif
***3.ZhanLianShi.c***
#include "ZhanLianShi.h"
#include <stdio.h&