单项选择题
以下程序中函数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.3
D.5