栈的结构定义
栈的初始化
我的代码
#include <stdio.h> #include <stdlib.h> #define MAXSIZE 100 typedef struct{ int *base;//栈顶指针int stacksize int *top;//栈底指针SElemType *top int stacksize;//栈可用最大容量}SqStack; }SqStack; SqStack* Initstack(SqStack *S){//构造一个空栈 S->base=malloc(MAXSIZE*sizeof(int)); if(!S->base)exit;//存储分配失败 S->top=S->base;//栈顶指针等于栈底指针S S->stacksize=MAXSIZE; } int main(){ }