首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include <string.h> main() {char *p="abcde\Ofghjik\0"; printf("%d\n",strlen(p)); } 程序运行后的输出结果是( )。
有以下程序: #include <string.h> main() {char *p="abcde\Ofghjik\0"; printf("%d\n",strlen(p)); } 程序运行后的输出结果是( )。
admin
2010-01-10
19
问题
有以下程序: #include <string.h> main() {char *p="abcde\Ofghjik\0"; printf("%d\n",strlen(p)); } 程序运行后的输出结果是( )。
选项
A、12
B、15
C、6
D、5
答案
8
解析
本题首先定义了一个字符型指针变量p,并用一个字符串给它赋值,然后调用printf()函数输出p所指向的字符串的长度。由于字符串的结束标记为、0,其长度为第1个\0前的字符个数,故长度为5。所以4个选项中D正确。
转载请注明原文地址:https://kaotiyun.com/show/HHWp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下面的语句用Array函数为数组变量a的各种元素赋值整数值:
在程序中要使用Array函数给数组arr赋初值,则以下数组变量定义语句中错误的是
假定在图片框Picture1中装入了一个图片,在程序运行中,为了清除该图片(注意,清除图片,而不是删除图片框),应采用的正确方法是
在标准模块中,将a定义为全局整型变量的语句是()。
以下关于控件数组的叙述中,错误的是
窗体的MouseUp事件过程如下:PrivateSubForm_MouseUp(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)……EndSub
假定在窗体上添加了一个通用对话框控件,其名称为CD1,并有如下程序段:CD1.ShowOpen:CD1.DefaultExt="doc"在打开文件的对话框中选择了"c:\file1.txt"文件,则FileTitle属性的值是
阅读程序:OptionBase1PrivateSubFormClick()Dima(3,3)AsIntegerFori=1To3Forj=1To3a(i,j)=_______
在窗体上画一个文本框,其名称为Text1,为了在程序运行后隐藏该文本框,应使用的语句为
下面关于VB应用程序的叙述中正确的是
随机试题
下列哪项是由地西泮的活性代谢产物制成的药品?()
下列说法正确的是()
现金流量折现法估算的结果精确,但比较复杂;传统方法估算的结果粗略,但相对简单些。()
在建立安全生产责任制的同时建立安全生产责任制的监督、检查等制度,特别要注意发挥()的监督作用,以保证安全生产责任制得到真正落实。
高桩码头施工期岸坡稳定性验算,在考虑了各种受荷隋况下,应与()组合验算。
用于预应力混凝土的钢绞线,按极限强度主要有():MPa和1860MPa~,
依据凯恩斯货币理论,货币供给增加将导致()。
4,7,13,25,49,()
手铐:警察:犯人
A.CausesofchangesB.IncreasingnumberofmuseumsandvisitorsC.MuseumsgettingclosertomorespectatorsD.Moviesshowni
最新回复
(
0
)