求解答啊 调用函数 按相反顺序存放
#include "stdio.h"#include "string.h"
int main()
{
void change(int x,char r[]);
char a[10];
int n;
gets(a);
n=strlen(a);
change(n,a);
puts(a);
return 0;
}
void change(int x,char r[])
{
int temp;
char *i=r ;char *p=r+x;
for(;r<(i+x)/2;r++)
{
temp=*r;
*r=*(p-r-1);
*(p-r-1)=temp;
}
}
c:\documents and settings\administrator\桌面\2.c(18) : error C2296: '/' : illegal, left operand has type 'char *'
c:\documents and settings\administrator\桌面\2.c(21) : error C2100: illegal indirection
c:\documents and settings\administrator\桌面\2.c(22) : error C2100: illegal indirection
c:\documents and settings\administrator\桌面\2.c(22) : error C2106: '=' : left operand must be l-value
Error executing cl.exe.