#include <stdio.h>
#include <stdlib.h>
#define bool char
#define true 1
#define false 0
#define MaxSize 1000
typedef int ElemType;
//定义栈的结构
typedef struct SqStack
{
ElemType data[MaxSize];
int top;
} SqStack;
//栈的初始化
bool InitStack(SqStack* S)
{
S->top = -1;
return true;
}
//栈判空
bool Empty(SqStack S)
{
if(S.top == -1)
return true;
else
return false;
}
//压栈
bool Push(SqStack* S, ElemType e)
{
//判断栈满的情况
if(S->top == MaxSize-1)
return false;
S->data[++S->top] = e;
return true;
}
//出栈
bool Pop(SqStack* S, ElemType* e)
{
if(S->top
pta数据结构7-170 逆波兰表达式求值
最新推荐文章于 2024-06-04 20:07:26 发布