首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下述语句中,在字符串s1和s2相等时显示“they are Equal”的是( )。 .
下述语句中,在字符串s1和s2相等时显示“they are Equal”的是( )。 .
admin
2020-10-26
29
问题
下述语句中,在字符串s1和s2相等时显示“they are Equal”的是( )。 .
选项
A、if(*s1==*s2)
puts("they are Equal");
B、if(!strcmp(s1,s2))
puts("they are Equal");
C、if(s1==s2)
Puts("they are Equal");
D、if(strcmp(s1,s2))
puts("they are Equal");
答案
B
解析
字符串比较不能用两个等号(==)来进行比较,应使用strcmp(s1,s2)函数来比较。strcmp(s1,s2)函数的功能是:当字符串s1和s2相等时,返回值为0,因此,当表达式!strcmp(s1,s2)==1时,条件成立,执行后面的语句,输出thev are Equal。
转载请注明原文地址:https://kaotiyun.com/show/4C3p777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序段:int*p1,*p2,a[10];p1=a;p2=&a[5];则p2一p1的值为()。
若有以下语句:typedefstructS{intg;charh;}T;以下叙述中正确的是()。【10年9月】
有以下程序:#includestruetS{inta,b;}data[2]={10,100,20,200};main(){structSp=data[1];printf("%d\n",++(p.a));}程序运行后的输出结果是(
以下关于retum语句的叙述中正确的是()。【10年3月】
关于程序设计基本概念,以下叙述错误的是()。
下面属于黑盒测试方法的是()。
设fp为指向某二进制文件的指针,且已读到此文件末尾,则函数feof(fp)的返回值为()。
在一个C源程序文件中所定义的全局变量,其作用域为()。
某图书集团数据库中有关系模式R(书店编号,书籍编号,库存数量,部门编号,部门负责人),其中要求①每个书店的每种书籍只在该书店的一个部门销售;②每个书店的每个部门只有一个负责人;③每个书店的每种书籍只有一个库存数量。则关系模式R最高是
随机试题
在Excel中,表示所有字符的通配符是()
A、门静脉高压症的主要阻塞部位在窦前B、门静脉高压症的主要阻塞部位在窦后C、门静脉高压症的主要阻塞部位在窦内D、门静脉高压症的主要阻塞部位在肝前E、门静脉高压症的主要阻塞部位在肝后肝静脉阻塞综合征
下列有关阴道分泌物的描述,错误的是()
“备案号”栏:()。“提运单号”栏:()。
在PowerPoint中,“格式”菜单中的()命令可以用来改变某一幻灯片的布局。
法律、法规授权的具有管理公共事务职能的组织,在法定授权范围内,以自己的名义可以实施()。
大海、高峰、王昊准备去爬山。天气预报说,今天可能下雨。围绕天气预报,三个人争论起来。大海:“今天可能下雨,那并不排斥今天也可能不下雨,我们还是去爬山吧。”高峰:“今天可能下雨,那就表明今天要下雨,我们还是不去爬山了吧。”王昊:“今天可能下雨,只是表明今天不
19世纪前期,意大利革命党派创办过一些什么重要报纸?他们的办报目的是什么?
情景:AirFrance(法国航空公司)最近推出特别优惠机票网上订票活动。假如你是Jack,你在一周后要去Paris,请你以e-mail的形式向本地AirFrance办事处预定一张机票。在你的邮件相关地方要写清楚如下内容(不作要求的地方不需填写):收
中国的食物可以大致分成北方和南方两种烹饪风格。北方菜相对来说较油腻,喜欢在菜里使用醋(vinegar)和大蒜(garlic)。面食(cookedwheatenfood)是北方菜系的重要部分。面条、馄饨(ravioli)、饺子、包子(steamedst
最新回复
(
0
)