选择题
36.
有以下程序:
# include <stdio.h>
void exch(int t[])
{ t[0]=t[s];}
main()
{ int x[10]={1,2,3,4,5,6,7,8,9,10},i=0;
while(i<=4){exch(&x[i]);i++;}
for(i=0;i<5;i++)printf("%d",x[i]);
printf("\n");
}
程序运行后输出的结果是______。
A、
2 4 6 8 10
B、
1 3 5 7 9
C、
1 2 3 4 5
D、
6 7 8 9 10
【正确答案】
D
【答案解析】
本题中exch函数是用数组中的第6个元素对第1个元素进行赋值,所以数组的值应该为6 7 8 9 10。
提交答案
关闭