关于数据结构的问题(1)
#include<stdio.h>#include<stdlib.h>
#define MAXLEN 10
typedef struct
{ int data[MAXLEN];
int top;
}seqstack;
seqstack *Snull()
{seqstack *s;
s=malloc(sizeof(seqstack));
s->top=-1;
return s;}
int push(seqstack *s,int x)
{if(s->top==MAXLEN-1)
return 0;
else
{s->top++;
s->data[s->top]=x;
return 1;}
}
int sempty(seqstack *s)
{if(s->top==-1)
return 1;
else
return 0;
}
int sfull(seqstack *s)
{if(s->top==MAXLEN-1)
return 1;
else return 0;
}
int pop(seqstack *s,int *x)
{if(sempty(s))
return 0;
else
{*x=s->data[s->top];
s->top--;
return 1;
}
}
int readtop(seqstack *s)
{if(sempty(s))
return 0;
else
return(s->data[s->top]);
}
main()
{int *x=NULL;
seqstack *s;
s=Snull;
push(s,5);
printf("%d",readtop(s));
pop(s,x);
printf("%d",*x);
}
我怎么运行不了啊????????请各位帮忙看看啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!这是为什么???????????????????????????