首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include #include void fun(char *s[], int n) { char *t; int i, j; for (i=0; i
有以下程序 #include #include void fun(char *s[], int n) { char *t; int i, j; for (i=0; i
admin
2015-07-28
26
问题
有以下程序
#include
#include
void fun(char *s[], int n)
{ char *t; int i, j;
for (i=0; i
for (j=i+1; j
if (strlen(s
) > strlen(s[j]))
{ t = s
; s
= s[j]; s[j] = t; }
}
main()
{ char *ss[]={"bcc","bbcc","xy", "aaaacc", "aabcc"};
fun(ss, 5); printf("%s,%s\n", ss[0],ss[4]);
}
程序的运行结果是( )。
选项
A、xy,aaaacc
B、aaaacc,xy
C、bcc,aabcc
D、aabcc,bcc
答案
A
解析
函数fun()的功能是字符串数组s中的字符串依照其字符串长度从小到大排列,所以被调函数"fun(ss, 5); "执行完毕后,字符串数组ss为{"xy", "bcc", "bbcc", "aabcc", "aaaacc"},所以输出结果为选项A)。
转载请注明原文地址:https://kaotiyun.com/show/AzDp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有如下程序 #define N 2 #define M N+1 #define NUM 2*M+1 main() { int i; for(i=1;i<=NUM;i++) printf("%d\n"i) } 该程序中的for循环执行的次数是______。
有以下程序#includetypedefstruct{intnum;doubles;}REC;voidfunl(RECx){x.nllm=23;x.s=88.5;}main(){RECa={16,90.0);funl(A);
有以下程序#includemain(){intf,fl,f2,i;f1=0;{2=1;prinff(“%d%d”,fl,t2):for(i=3;i
若有以下程序段intr=8:prinff(“%d\n”,r>>1);输出结果是
有以下程序#include#definef(X)X*X*Xmain(){inta=3,s,t;s=f(a+1);t=f((n+1));printf(“%d,%d\n”,s,t);}程序运行后的输出结果是
设有以下函数:voidfun(intn,char*$s){……}则下面对函数指针的定义和赋值均正确的是
有以下程序#include#includemain(){chara[10]=”abcd”;prinff(“%d,%d\n”,strlen(A),sizeof(A));}程序运行后的输出结果是
有以下程序#include#includemain(){charstr[][20]={“Qne*World”,“one*Dream!”},*P=str[1].prinff(“%d,”,strlen(p));printf(“%s\n”,P)
有以下程序#includemain(){chars[]={“012xy”};inti,n=0;for(i=0;s[i]!=0;i++)if(s[i]>=‘a’&&8[i]
随机试题
[背景资料]某施工单位承接的二级公路中有四道单跨2.0×2.0m钢筋混凝土盖板涵,在编制的《施工组织设计》中,对各涵洞的工序划分与工序的工作时间分析如表2B320020—1所示。施工单位最初计划采用顺序作业法组织施工,报监理审批时,监理
有n个进程都要使用某个共享文件,但系统限制最多可以有m个进程(n>m>1)同时读文件。用PV操作管理时,信号量的值不可能变化为
改革的特征是()。
Trainingastronauts______notaneasything.
妇女为防止非意愿妊娠的发生而采用的紧急避孕药物有()。
直接故意与间接故意的区别是:
依据《煤矿安全监察条例》,煤矿安全监察人员发现煤矿矿长或者其他主管人员违章指挥工人或者强令工人违章、冒险作业,应采取的措施是()。
关于矿山井下的防尘措施,说法错误的是()。
自行车比赛常见的场地赛项目有个人赛和()。
①在这种形势下,西方出现了青年现象的退潮,表现为批判能力的下降,青年人安于现状②现实呼吁青年精神的回归,无论解决问题的创造性,还是对历史使命的担当,希望还在青年③新的思想创造了青年,青年创造了新的时代④但从世界范围内来看,自从
最新回复
(
0
)