//判断一个算术表达式的圆括号是否正确配对
#include
#define MAXSIZE 1000
typedef char datatype;
typedef struct Stack{
datatype elements[MAXSIZE];
int Top;
}stacky;
stacky *SetnullS(stacky *S){
S->Top=-1;
return S;
}
int Empty(stacky *S){
if(S->Top==0)
return 1;
else return 0;
}
stacky *push(stacky *S,datatype e){
if(S->Top>=MAXSIZE-1){
printf ("overflow");
return NULL;
}
else {
S->Top++;
S->elements[S->Top]=e;
}
return S;
}
stacky*pop(stacky *S){
S->Top--;
return S;
}
int Scan(stacky *S,char a[]){
int i;
for(i=0;i
if(a[i]=='(')
push(S,a[i]);
else if(a[i]==')'){
pop(S);
}
}
if(S->Top==0) return 1;
else return 0;
}
void main(){
int key;
char a[100]={'(',')','(',')'};
stacky *S;
SetnullS(S);
//gets(a);
key=Scan(S,a);
if(key==1) printf("match");
else printf("unmatch");
}
请问这个程序哪里出错了呢··运行不了