//栈的基本操作
#define ERROR 0
#define OVERFLOW -2
#define Stack_init_size 100
#define Stackincrement 10
#include<malloc.h>
#include<stdio.h>
typedef int SElemType;
typedef struct
{
SElemType *base;
SElemType *top;
int stacksize;
}SqStack;
void main()
{
SElemType e;
SqStack S;
void InitStack(SqStack*S); //构造栈的声明
void GetTop(SqStack*S,SElemType e); //取栈顶元素函数声明
void Push(SqStack*S,SElemType e); //进栈函数声明
void Pop(SqStack*S,SElemType e); //弹出栈顶元素函数声明
printf("构造一个栈并读入数据:\n");
InitStack(&S); //构造栈
GetTop(&S,e); //取栈顶元素
Push(&S,e); //进栈
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余3页未读,立即下载