以下程序中函数f的功能是将n个字符串按由大到小的顺序进行排序: #include
问题:
以下程序中函数f的功能是将n个字符串按由大到小的顺序进行排序:
#include <string.h>
void f(char p[][10],int n)
char t[20]; int i,j;
for(i=0;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[0]));
程序运行后的输出结果是( )。
A.6
B.4
C.5
D.3