第9题
下面invert函数的功能是将一个字符串str的内容颠倒过来。请填空(英文输入法填空,两空用英文“,”隔开)。 #include <string.h> void invert(char str[]) { int i,j,____; for(i=0,j=strlen(str)____;i <j;i++,j--) { k="str[i];" str[i]="str[j];" str[j]="k;" }>
点击查看答案
第10题
有以下程序: void f(int *x,int *y) { int t; t=*x;*x=*y;*y=t; } void main() { int a[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a;q=&a[7]; while(*p!=*q){f(p,q);p++;q--;} for(i=0;i<8;i++) printf("%d,",a[i]); } 程序运行后的输出结果是( )。> A、8,2,3,4,5,6,7,1,
B、5,6,7,8,1,2,3,4,
C、1,2,3,4,5,6,7,8,
D、8,7,6,5,4,3,2,1,
点击查看答案