题目详情:
发布时间:2020-06-20 22:27:06
[单选题]有以下程序,其中函数f的功能是将多个字符串按字典顺序排序
#include <string.h>
Void f(char *p[],int n)
{ char *t; int i,j;
For(i=0;i<n-1;i++)
For(j=i+1;j<n;j++)
If(strcmp(p[i],p[j])>0){ t=p[i]; p[i]=p[j]; p[j]=t; }
}
Main()
{ char *p[5]={"abc","aabdfg","abbd","dcdbe","cd"};
F(p,5);
Printf("%d\n",strlen(p[1]));
}
程序运行后的输出结果是()。
A.2
B.3
C.6
D.4
更多"[单选题]有以下程序,其中函数f的功能是将多个字符串按字典顺序排序#i"的相关试题: