10_4求助
zkm11 2003-10-09 07:30:16 #include "stdio.h"
void fff(char *p)
{
char*s,*t,*r;
for(s=p;s!='\0';s++); \* 指针s移到'\0'前一个字符*\
s--;
for(r=p;r<s;r++,s--)
{ *t=*r;
*r=*s;
*s=*t;
}
return(p);
}
main()
{char a[80]={"abcdefghij"};
FILE *p;
if ((p=fopen("file2.txt","w"))==NULL)
{printf("this file can not open\n");
exit(0);}
fff(a);
printf("%s",a);
printf("\n");
fprintf(p,"%s\n",a);
fclose(p);
}
编写一个函数fff,它的功能是将任意一个字符串,按相反次序排序并输出其中的所有字符(要求用指针)
注意:部分源程序已给出,请勿改动主函数main()和已给出的源程序,仅在fff函数中的花括号内填入你编写地若干语句