第3套
填空题
请补充函数FUN(CHAR *S),该函数的功能是把字符串中的内容逆置.
例如:字符串中原有的字符串为abcde,则调用该函数后,串中的内容为edcba.
请勿改动主函数main和其他函数中的任何内容,仅在fun函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include
#include
#include
#define N 81
void fun(char *s)
{
int i, n = strlen(s)-1;
char t;
for (i=0; i
{
t = s[i];
___2___;
___3___;
}
}
main()
{
char a[N];
printf("Enter a string:");
gets(a);
printf("The original string is:");
puts(a);
fun(a);
printf("\n");
printf("The string after modified:");
puts(a);
}
第1处填空:n--或--n或n-=1或n=n-1
第2处填空:s[i]=s[n]或*(s+i)=*(s+n)
第3处填空:s[n]=t或*(s+n)=t
编辑特别推荐: