问题遇到的现象和发生背景
为什么 stack Creatstack()那里出现Segmentation fault?
问题相关代码,请勿粘贴截图
#include <stdio.h>
#define MAXSIZE 10
typedef struct _stack *stack;
struct _stack{
int st[MAXSIZE];
int top1;
int top2;
};
int main(){
stack s1 = Creatstack();
return 0;
}
stack Creatstack(void){
stack s;
(s->top1)=1;
(s->top2)=MAXSIZE;
return s;
}