[求助]高手帮忙,新人编程遇到问题"expression syntax error"
#define M 30#define ture 1
#define false 0
#include <stdio.h>
typedef struct
{
char elem[M];
int top;
}seqstack;
void Initstack(seqstack *ali)
{ali->top=-1;
}
int Push(seqstack *ali,char *ch)
{if(ali->top==(M-1))
return(false);
ali->top++;
ali->elem[ali->top]=*ch;
return(ture);
}
int Pop(seqstack *ali,char *ch1)
{if(ali->top==-1)
return(false);
else
{*ch1=ali->elem[ali->top];
ali->top--;
return(ture);
}
}
int Gettop(seqstack *ali,char *ch1)
{if(ali->top==-1)
return(false);
else
{*ch1=ali->elem[ali->top];
return(ture);
}
}
Isempty(seqstack *ali)
{
if(ali->top==-1)
return(ture);
else
return(false);
}
void Huiwen(char *str)
{seqstack ali;
int i;
char ch;
char ch1;
Initstack(&ali);
for(i=0;str[i]!='&';i++)
Push(&ali,str[i]); /*这里是警告,不可移植的指针比较*/
i++;
while(!Isempty(&ali)&&str[i]!='@')
if(Isempty(&ali))
{printf("\nbu shi huiwen!");return;
}
else
{ch=str[i];
Gettop(&ali,&ch1);
if(ch==ch1)
{Pop(&ali,&ch1);
i++;
}
else
{printf("\nbushi huiwen!");return;
}
}
if(Isempty(&ali))
printf("\nshi hui wen!");
else
printf("\nbu shi huiwen!");
}
main()
{char str[M];
int i;
for(i=0;i<M;i++)
scanf("%c",str[i]);
Huiwen(char &str);/*这里是错误,表达式语法错误*/
getch();
}
[此贴子已经被作者于2007-4-10 9:31:45编辑过]