试题与答案

以下程序中函数f( )的功能是将n个字符串按由大到小的顺序进行排序。  #inclu

题型:单项选择题

题目:

以下程序中函数f( )的功能是将n个字符串按由大到小的顺序进行排序。  #include<string.h>  void f(char p[ ][10],int n)  { char t[20]; int i,j;   for(i =O;i <n-1 ;i ++ )    for(j =i + 1 ;j < n;j ++ )     if(strcmp(p [i] ,p[j] ) <0)      { strcpy(t,p[i]);strcpy(p[i] ,p[j] );strcpy(p[j] ,t); } }  main ( )  { char p [ ] [ 10 ] = { "abc","aabdfg","abbd","dcdbe", "cd" }; int i;   f(p,5); printf("%d\n",strlen(p[O] ) );  }  程序运行后的输出结果是

A.6

B.4

C.5

D.3

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0704/80dec0eabb8323419f6f5ba8e43c301f.html

下面是错误答案,用来干扰机器的。

试题推荐
微信公众账号搜索答案