热门

最新

红包

立Flag

投票

同城

我的

发布
jersey_l
Jersey_L
4 年前
truejersey_l

#include<stdio.h>
#include<malloc.h>
#define MaxSize 100
typedef char ElemType;
typedef struct
{
ElemType date[MaxSize];
int top;
}SqStack;
void InitStack_luoweicheng(SqStack *&s)
{
s=(SqStack *)malloc(sizeof(SqStack));
s->top=-1;
}
void DestroyStack_luoweicheng(SqStack *&s)
{
free(s);
}
bool StackEmpty_luoweicheng(SqStack *&s)
{
return (s->top==-1);
}
bool Push_luoweicheng(SqStack *&s,ElemType &e)
{
if(s->top==MaxSize-1) return false;
s->top++;
s->date[s->top]=e;
return true;
}
bool Pop_luoweicheng(SqStack *&s,ElemType &e)
{
if(s->top==-1) return false;
e=s->date[s->top];
s->top--;
return true;
}
bool GetTop_luoweicheng(SqStack *&s,ElemType &e)
{
if(s->top==-1) return false;
e=s->date[s->top];
return true;
}

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
这里有接触这些产品的铁子吗#智能监控箱
立即登录