首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include<stdio.h> main() {int i,j=0; char a[]="ab123c4d56ef7gh89"; for(i=0;a[i];i++) if(a[i]>=’0’&&a[i]<=’9’)
有以下程序 #include<stdio.h> main() {int i,j=0; char a[]="ab123c4d56ef7gh89"; for(i=0;a[i];i++) if(a[i]>=’0’&&a[i]<=’9’)
admin
2022-10-24
26
问题
有以下程序
#include<stdio.h>
main()
{int i,j=0;
char a[]="ab123c4d56ef7gh89";
for(i=0;a
;i++)
if(a
>=’0’&&a
<=’9’)
a[j++]=a
;
a[j]=’\0’;
printf("%s",a);
}
程序运行后的输出结果是( )。
选项
A、123456789abedefgh
B、abcdefgh
C、123456789
D、1234567896ef7gh89
答案
C
解析
题干中定义了字符数组a,它包含数字字符和字母字符。通过for循环,将a中所有的数字字符前移,舍去其他字符,并在数字字符后添加字符串结束符“\0”,for循环结束后,字符串a的值为123456789。故本题答案为C选项。
转载请注明原文地址:https://jikaoti.com/ti/xKd0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下选项中不属于C语言程序运算符的是
下面函数的功能是()。sss(s,t)char*s,*t;{while(*s);while(*t)*(s++)=*(t++);returns;}
若函数调用时的实参为变量时,以下关于函数形参和实参的叙述中正确的是
若变量均已正确定义并赋值,以下合法的C语言赋值语句是()。
要求定义一个具有6个元素的int型一维数组,以下选项中错误的是()。
使用VC++2010打开考生文件夹下blank1中的解决方案。此解决方案的项目中包含一个源程序文件blank1.c。程序的功能是调用fun函数建立班级通信录。通信录中记录每位学生的编号、姓名和电话号码。班级人数和学生信息从键盘读入,每个人的信息作为一个数
使用VC++2010打开考生文件夹下modi1中的解决方案。此解决方案的项目中包含一个源程序文件modi1.c。在此程序中,函数fun的功能是:比较两个字符串,将长的字符串的首地址作为函数值返回。请改正程序中的错误,使它能得出正确的结果。
请编写函数fun,其功能是:将一个数字字符串转换为一个整数(不得调用C语言提供的将字符串转换为整数的函数)。例如,若输入字符串“-1234”,则函数把它转换为整数值-1234。注意:部分源程序给出如下。请勿改动主函数main和其他函数中
设有条件表达式:(ExP)?i++;j--,则以下表达式中(EXP)完全等价的是()。
有三个关系R、S和T如下:则由关系R和S得到关系T的操作是( )。
随机试题
下列关于劳动争议仲裁时效的表述错误的是()
Thechildrenareas______aslarks.
下列案件中,导致立案管辖和审判管辖的主体重合的是:()
为社会提供检测或校准服务的实验室为()。
班级授课辅助的教学组织形式是()。
信念的特征表现在,它具有()
(16年)设矩阵,且方程组Aχ-β无解.(Ⅰ)求a的值;(Ⅱ)求方程组ATAχ=ATβ的通解.
操作数地址的16位偏移量(又称有效地址EA)直接包含在指令中,紧跟在操作码之后,存放在代码段区域的寻址方式是
Onthefirstdayofschooloneofmyclassmatesbeganatalkwithmethatchangedmylife.Shesaid,"Hi,handsome.MynameisR
ShouldWeEmbraceCyberspeak?1.越来越多的网络用语渗透到日常口语和书面语中2.有人认为这是语言发展的结果,也有人认为这是对语言的污染3.我的看法
最新回复
(
0
)