郁闷,这里有问题吗?
#include <stdio.h>#define MAXSIZE 50
#define OK 1
#define ERROR 0
typedef struct
{
char elem[MAXSIZE];
int top;
}seqstack;
int judge()
{
seqstack *x;
x->top=-1;
char ch;
printf("请输入字符串:");
ch=getchar();
while(ch!='@'&&ch!='&')
{
x->top++;
x->elem[x->top]=ch;
ch=getchar();
}
ch=getchar();
while(ch!='@')
{
if (ch==x->elem[x->top])
{
x->top--;
}
else
return ERROR;
if (x->top==-1)
return OK;
ch=getchar();
}
}
int main()
{
int a;
a=judge();
if (a==OK)
printf("满足条件!!");
else
printf("不满足条件!!");
return 0;
}
大家帮我看看这个程序,运行到x->top=-1;这句会出错,有什么问题吗?