第三章 栈队列和数组
Posted 菜鸟学码
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第三章 栈队列和数组相关的知识,希望对你有一定的参考价值。
栈定义
const int maxsize=6;
typedef struct seqstack
{
DataType data[maxsize];
int top;
}SeqStk;
基本运算
1 初始化
int InitStack(SeqStk *stk)
{
stk-top=0;
return 1;
}
2 判栈空
int EmptyStack(SeqStk *stk)
//若栈为空,则返回值1,否则返回值0
{
if (stk->top==0)
return 1;
else return 0;
}
3 进栈
int Push(SeqStk *stk,DataType x)
以上是关于第三章 栈队列和数组的主要内容,如果未能解决你的问题,请参考以下文章