首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #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
48
问题
有以下程序
#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全国计算机二级
相关试题推荐
以下程序的输出结果是( )。 #finclude "stdlib.h" fun(int**p,int a[3][3]) { **p=a[2][2];} main() { int a[3][3]={2,4,6,8,10,12,14,16,18},*p; p=
有如下程序 #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);输出结果是
下面结构体的定义语句中,错误的是
设有以下函数:voidfun(intn,char*$s){……}则下面对函数指针的定义和赋值均正确的是
有以下程序#include#includemain(){chara[10]=”abcd”;prinff(“%d,%d\n”,strlen(A),sizeof(A));}程序运行后的输出结果是
随机试题
行政诉讼中的第三人
情境教学法所属的教学方法类型是()。
A.上行沟通B.下行沟通C.横向沟通D.逆向沟通E.沟通障碍护理部与后勤部门之间的沟通属于()
甲公司将承建的建筑工程承包给无特种作业操作资格证书的邓某,邓某在操作时引发事故。某省建设厅作出暂扣甲公司安全生产许可证三个月的决定,市安全监督管理局对甲公司罚款三万元。甲公司对市安全监督管理局罚款不服,向法院起诉。下列哪些选项是正确的?(2009年试卷二第
哲学基本问题的第一方面即物质和精神何者为第一性问题是()。
已知du(x,y)=[axy3+cos(x+2y)]dx+[3x2y2+bcos(x+2y)]dy,则()
A、 B、 C、 D、 B
ThefollowingmaximsaretheCooperativePrinciplesEXCEPT
Thispartistotestyourabilitytodopracticalwriting.Youarerequiredtowriteanotetotransmitatelephonemessageacco
Thereisatimewhenjobseekerssimplywrotelettersofapplication."Justputdownyourname,【B1】______,ageandwhetheryou
最新回复
(
0
)