请教一下这个程序如何改?
猪大哥呀 2012-03-21 07:40:18 #include<iostream>
using namespace std;
typedef struct
{char data[10];
int top;
}sqstack;
void initstack(sqstack *&s)
{s=(sqstack *)malloc(sizeof(sqstack));
s->top=-1;
}
int push(sqstack *& s,char &e)
{if(s->top==9)
return 0;
s->top++;
s->data[s->top]=e;
return 1;
}
int pop(sqstack*&s,char e)
{if (s->top==-1)
return 0;
e=s->data[s->top];
s->top--;
return 1;
}
int huiwen(char str[])
{int i;
char e;
sqstack *st;
initstack(st);
for(i=0;str[i]!='\0';i++)
push(st,str[i]);
for(i=0;str[i]!='\0';i++)
{pop(st,e);
if(str[i]!=e)
return (0);
}
return(1);
}
int main()
{
char n,str[10];
for(int i=0;i<10;i++)
{cin>>n;
str[i]=n;
}
huiwen(str[10]);
return 0;
}
error C2664: 'huiwen' : cannot convert parameter 1 from 'char' to 'char []'