首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include int fun( char s[] ) { char *p = s; while( *p != 0 ) p++; return ( p-s ); } main() { printf("%d\n", fun("0ABC
有以下程序 #include int fun( char s[] ) { char *p = s; while( *p != 0 ) p++; return ( p-s ); } main() { printf("%d\n", fun("0ABC
admin
2015-07-31
30
问题
有以下程序
#include
int fun( char s[] )
{
char *p = s;
while( *p != 0 ) p++;
return ( p-s );
}
main()
{
printf("%d\n", fun("0ABCDEF") );
}
程序运行后的输出结果是
选项
A、1
B、6
C、7
D、0
答案
C
解析
本题考查字符串作为函数参数以及while语句,本题中传入字符串OABCDEF,然后执行fun后,就得到了该字符串中字符的个数,不包括结尾符,该字符串有7个字符,所以答案为C。
转载请注明原文地址:https://kaotiyun.com/show/P2Dp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
若要用下面的程序片段使指针变量P指向一个存储整型变量的动态存储单元int*p;p=______malloc(sizeof(int));则应填入______。
下列叙述中正确的是()。
下列程序的运行结果是______。main(){inta[6],i;for(i=2;i<6;i++){a[i]=4*(i-2*(i>3))%5;printf("%2d",a[i]);
以下程序段的执行结果为______。#definePLUS(X,Y)X+Ymain(){intx=1,y=2,z=3,sum;sum=PLUS(x+y,z)*PLUS(y,z);printf("S
下面程序段的输出结果是()。inti=32770;printf("%d\n",i);
下列选项中属于C语言构造类型的是()。
在“文件包含”预处理语句的使用形式中,当#include后面的文件名用""(双撇号)括起时,寻找被包含文件的方式是()。
若执行下列程序时从键盘上输入2,则输出结果是()。#include<stdio.h>main(){inta;scanf("%d",&a);if(a++<3)printf("%d\n",a);
下列特征中不是面向对象方法的主要特征的是()。
设有表示学生选课的三张表,学生S(学号,姓名,性别,年龄,身份证号),课程C(课号,课名),选课SC(学号,课号,成绩),则表SC的关键字(键或码)为
随机试题
从所给的四个选项中,选择最合适的一项填入问号处,使之呈现一定的规律性。
简述中国共产党是怎样实现对统一战线的领导权。
支气管扩张患者肺部X线检查可表现为
(2005年)如图3.4—1所示,送风系统采用调速风机,现LA=1000m3/h,LB=1500m3/h,为使LA=LB=1000m3/h,可采用下列哪种方法?()
违反《水污染防治法》规定,排放水污染物超过国家或者地方规定的水污染物排放标准,或者超过重点水污染物排放总量控制指标的,由县级以上人民政府环境保护主管部门按照权限()
背景某安装公司承接了一新建供暖厂的建设合同。设备安装量有4台引风机、8台鼓风机、2台20t桥式起重机、26台水泵、4台胶带输机、10台螺旋输机、2台斗式提升机、2台振动筛的安装。引风机经过就位、地脚螺栓灌浆、初找、精找等工序,最先达到了单机试车的
下列关于高等教育的说法,正确的是( )。
物业服务企业的财务费用不包括()
下列关于管道流的叙述中,正确的是()。
PriceTermsImportantPriceInformationUnlessotherwiseexpresslynoted,allpricesareperperson,basedondoubleoccupancyo
最新回复
(
0
)