首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #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
70
问题
有以下程序
#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=
以下程序运行后的输出结果是【】。#includemain(){intx=20;prinff(“%d”,0
下面结构体的定义语句中,错误的是
有以下程序#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(){charstr[][20]={“Qne*World”,“one*Dream!”},*P=str[1].prinff(“%d,”,strlen(p));printf(“%s\n”,P)
有以下程序#includemain(){intm=1,n=2,*P=&m,*q=&n,*r;r=P;P=q;q=r;prinff(“%d,%d,%d,%d\n”,m,n,*P,*q);}程序运行后的输出结果是
有以下程序#includemain(){charel,c2;el=‘A’+‘8’-14’:c2=‘A’+‘8’-‘5’:printf(“%e,%d\n”,c1,c2);}已知字母A的ASCII码为65,程序运行后的输出结果是
有以下程序#includemain(){int13=2,k=0;while(k++&&n++>2);Pintf(”%d%d\n”,k,n.);}程序运行后的输出结果是
有以下程序#includemain(){chars[]={“012xy”};inti,n=0;for(i=0;s[i]!=0;i++)if(s[i]>=‘a’&&8[i]
随机试题
网络营销对传统营销中的定价策略的影响包括()
下列对Access2010中主键的叙述,错误的是______________。
归脾汤除益气健脾、补血外,还具有的功用是( )。参苓白术散除益气健脾、止泻外,还具有的功用是( )。
在各类辨证法中,八纲辨证的总纲是()。
抵达景点时,下车前地陪要讲清并提醒旅游者记住()
中共十一届三中全会标志着新时期党的基本路线的思想开始形成,主要表现在提出了()。
A.ariseB.thinkofC.tendtoD.consideredPhrases:A.itmaybe【T13】______foolishB.misunderstandings【T14】______betweenpe
Whoistheintendedaudienceforthistalk?
Itisaknownfactthatphysicalactivityimprovesoverallhealth.Notonlydoesitimprovecirculation,increasebloodflowto
Peoplelearnlanguagesallthetime,andforallkindsofreasons.Forexample,youprobablyhavevariousreasonstostudy【M1】__
最新回复
(
0
)