首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
以下程序: #include<stdio.h> main() { char str[10]; scanf(’’%s’’,&str); printf(’’%s\n’’,str);} 运行上面的程序,输入字符串
以下程序: #include<stdio.h> main() { char str[10]; scanf(’’%s’’,&str); printf(’’%s\n’’,str);} 运行上面的程序,输入字符串
admin
2020-10-26
27
问题
以下程序:
#include<stdio.h>
main()
{ char str[10];
scanf(’’%s’’,&str);
printf(’’%s\n’’,str);}
运行上面的程序,输入字符串“how are you”,则程序的执行结果是( )。
选项
A、how
B、how are you
C、h
D、howareyou
答案
A
解析
当从键盘输入“how are you”时,由于scanf输入函数的特点是遇到空格时结束读入字符,因此,该程序只将how这3个字符送到了字符数组str中,并在其后自动加上结束符“\0”。
转载请注明原文地址:https://kaotiyun.com/show/7J3p777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序voidfun2(chara,charb){printf("%c%c",a,b);}chara---’A’,b=’B’;voidfun1(){a=’C’:b=’D’;}main(){fun1();printf("%c%c
以下关于C语言数据类型使用的叙述中错误的是
以下选项中不属于C语言程序运算符的是
以下函数按每行8个输出数组中的数据:voidfun(int*w,intn){inti;for(i=0;i<n;i++){_______printf("%d",w[i]);}printf("\n");}下划线处应填入的语句是
有以下程序voidfun(intn,int*s){intf;if(n==1)*s=n+1;else{fun(n-1,&f);*s=f;}}main(){intx=0;fun(4,&x);printf("%d\n,x);}程序运行后的
有以下程序main(){inta[5]={2,4,6,8,10},*p,*k;p=a:k=&p;printf("%d",*(p++));printf("%d\n",**k);}程序运行后的输出结果是
有以下程序,程序的输出结果是voidfun(double*p1,double*p2,double*s){s=(double*)calloc(1,sizeof(double));*s=*p1+*(p2+1);}main(){doublea[2]=
有以下程序,程序运行后的输出结果是#include<stdio.h>#definefix)x*x*xmain(){inta=3,s,t;s=f(a+1);t=f((a+1));printf("%d,%d\n",s,t);}
设文件指针fp已定义,执行语句fp=fopen("file","w”);后,以下针对文本文件file操作叙述的选项中正确的是
下面关于位运算符的叙述,正确的是
随机试题
下列叙述错误的是()。
在对企业长期偿债能力进行分析时,除了关注企业资产和负债的规模与结构外,还需要关注企业的()
关于违约责任的归责原则,表述正确的是()。
根据世界卫生组织规定,诊断高血压的标准是
甲向乙借款5万元,并以一台机器作抵押,办理了抵押登记。随后,甲又将该机器质押给丙。丙在占有该机器期间,将其交给丁修理,因拖欠修理费而被丁留置。下列哪些说法是正确的?()。
人机功能匹配要在功能分析基础上,依据人机特性进行分配。下列任务中,适合机器完成的是()。
三个和尚没水吃三个和尚没水喝,怎么办?三个和尚利用星期天的时间在一起开会,商讨如何解决庙里喝水的问题。最后大家发现其实解决这个问题并不复杂。小和尚说:“我看得发明一种新的挑水的设备才行,有三条扁担那种设备,一桶水由我们三个人一起来挑。”大家
有关美国的独立管制机关的立法权,下列说法错误的是()
善意取得制度适用于()。
A、Hehadadoctorexaminehisinjuries.B、Hewassupposedtomeetthewomanyesterday.C、He’llhavetoexplainwhyhemissedpra
最新回复
(
0
)