stackimplement.h
来自「关于迷宫问题的几种解法」· C头文件 代码 · 共 42 行
H
42 行
//
//****************************栈及其操作实现的头文件************************
// StackImplement.h
// 本模块使用顺序存储实现栈
// wjluo,2004年3月4日
//**************************************************************************
//
#ifndef _WENJIAN_LUO_STACK_IMPLEMENT_H_
#define _WENJIAN_LUO_STACK_IMPLEMENT_H_
#define OK 1
#define ERROR 0
#define OVERFLOW -2
//***********************栈元素类型定义*********************//
typedef struct{
int x;
int y; //横坐标和纵坐标
}SElemType;
//**********************顺序栈定义************************************
#define STACK_INIT_SIZE 100 //存储空间初始分配量
#define STACKINCREMENT 10 //存储空间分配增量
typedef struct{
SElemType *base; //栈底指针
SElemType *top; //栈顶指针
int stacksize; //已分配存储量,一元素为单位
}SqStack;
//*********************基本操作的函数原型说明*************************
short int InitStack(SqStack &S); //构造一个空栈S
short int DestroyStack(SqStack &S); //销毁栈S
short int ClearStack(SqStack &S); //清空栈S
short int StackEmpty(SqStack S); //若栈S为空,返回True,否则返回False
short int StackLength(SqStack S); //返回栈S中的元素个数
short int GetTop(SqStack S, SElemType &e); //栈不空则返回栈顶元素,否则返回False
short int Push(SqStack &S, SElemType e);
short int Pop(SqStack &S, SElemType &e);
#endif /*#ifndef _WENJIAN_LUO_STACK_IMPLEMENT_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?