求括号的匹配,求结果?
这是我的程序,#include"stdio.h"
#define STACK_INIT_SIZE 20
#define STACKINCRE MENT 10
typedef char ElemType /*将char类定义为ElemType*/
typedef struct{ /*定义一个栈类型*/
ElemType *base;
ElemType *top;
int stacksize;
}sqstack;
initstack(sqstack*s)
{
s->stack=(ElemType*)malloc(STACK_INIT_SIZE*sizeof(ElemType));
if(!s->stack) exit(0);
s->top=s->base;
s->stacksize=STACK_INIT_SIZE;
}
push(stack*s,ElemType){
if(s->top-s->base>=stacksize)
{
s->base=(ElemType*)malloc(s->base,(s->stacksize+STACKINCREMENT)sizeof(ElemType));
if(!s->base) exit(0);
s->top=s->base+stacksize; /*..................*/
}
*(s->stop)=e;
s->top++;
}
pop(sqstack*s,ElemType*e){
if(s->top=s->base) return;
*e=*--(s->top);
}
int stackLen(sqstack s){
return (s.base-s.top) /*...........*/
}
int match(char e,char c){
if(e=='('&&c=')' return 1;
if(e=='['&&c==']' return 1;
return 0;
}
main()
{sqstack s;
char e,c;
initstack(&s);
scanf("%c",&c);
while(c!='#'){
if(!stackLen(s))
push(&s,c);
else
{pop(&s,&e);
if(!match(e,c)){
push(&s,e);
push(&s,c);
}
}
scanf("%c",&c);
}
if(!stackLen(s)) printf("the branchets are matched/n");
else printf("the branchets are matched/n");
getche();
}
结果一直都是
--------------------Configuration: .dsp - Win32 Debug--------------------
Compiling...
Error spawning cl.exe
.obj - 1 error(s), 0 warning(s)
怎么解释?请高手指点。