单选题 C语言
题号 #1556695

有以下程序
#include
#include
main()
{char a[5][10]={"china","beijing","you","tiananmen","welcome”);
int i,j;chart[10];
for(i=0;i<4;i++)
for(j=i+1;j<5;j++)
if(strcmp(a[i],a[j])>O)
{strcpy(t,a[i]);strcpy(a[i],a[j]);strcpy(a[j],t);}
puts(a[3]);
)
程序运行后的输出结果是(  )。

进入在线模考

参考答案

C

答案解析

由程序中的两层for循环可知,对数组串数组进行从小到大的排序,所以字符串数组a[][],经过排序后值应该为(¨beijing”,”china”,”tiananmen”,"welcome",”you”),输出字符串a[3]的值为“welcome”。

你可能感兴趣的试题

找试题 · 找答案 · 找资料 在线模考