首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
若有以下程序 #include char *a="you"; char b[ ]="Welcome you to China!"; main() { int i, j=0; char *p; for ( i=0; b[i] !=’\0’; i++ ) {
若有以下程序 #include char *a="you"; char b[ ]="Welcome you to China!"; main() { int i, j=0; char *p; for ( i=0; b[i] !=’\0’; i++ ) {
admin
2015-07-28
71
问题
若有以下程序
#include
char *a="you";
char b[ ]="Welcome you to China!";
main()
{ int i, j=0; char *p;
for ( i=0; b
!=’\0’; i++ )
{ if (*a == b
)
{ p=a;
for (j=i; *p!=’\0’; j++)
{ if (*p != b[j]) break;
p++;
}
if (*p==’\0’) break;
}
}
printf("%s", &b
);
}
则程序的输出结果是( )。
选项
A、you to China!
B、to China!
C、me you to China!
D、China!
答案
A
解析
该段代码查找字符串b中是否包含和a指向的字符串相同的字符串,跳出循环时i记录的是最初匹配的元素在数组b的下标,即是字符′y′的下标,所以输出字符串的结果为选项A)。
转载请注明原文地址:https://kaotiyun.com/show/VzDp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序#includetypedefstruct{intnum;doubles;}REC;voidfunl(RECx){x.nllm=23;x.s=88.5;}main(){RECa={16,90.0);funl(A);
若有定义语句:inta=5;,则表达式:a++的值是【】。
程序流程图中的菱形框表示的是【】。
若有以下程序段intr=8:prinff(“%d\n”,r>>1);输出结果是
有以下程序#include#includestruetA{inta;charb[10];doublec;};structAf(structAt);main(){structAa={1001,“ZhangDa”,1098
下面结构体的定义语句中,错误的是
有以下程序#include#definef(X)X*X*Xmain(){inta=3,s,t;s=f(a+1);t=f((n+1));printf(“%d,%d\n”,s,t);}程序运行后的输出结果是
有以下程序#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(){int13=2,k=0;while(k++&&n++>2);Pintf(”%d%d\n”,k,n.);}程序运行后的输出结果是
随机试题
录用涉及国家安全、保密或者专门技术性很强的特殊职位的公务员,不宜进行公开考试,但须经______批准。
从网络的覆盖范围与规模分类,可以将网络分为()。
A.石膏、知母B.石膏、人参C.石膏、粳米D.石膏、牛膝E.石膏、寒水石(2005年第96,97题)属于桂苓甘露饮组成药物的是()
A.细胞毒性脑水肿B.血管源性脑水肿C.混合性脑水肿D.先有细胞毒性后转化为血管源性脑水肿E.脑水肿以脑灰质的肿胀甚于白质下列疾病多见于哪一种类型的脑水肿脑缺血、缺氧的初期
在国际贸易中,签订合同的基础是()。
同一财产法定登记的抵押权与质权并存时,抵押权人优先于质权人受偿。()
教师职业劳动的示范性
Onehundredyearsago,therewasacleardifferenceamongtownandcountry.Butthemotorcarhaschanged【S1】_________.
Childrenlivingwithsingleparentsencountermanyproblems.Theyaremore【C1】______stressfulexperiencesthanarechildrenlivi
Manyprivateinstitutionsofhighereducationaroundthecountryareindanger.Notallwillbesaved,andperhapsnotalldeser
最新回复
(
0
)