首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include<stdio.h> #include<string.h> void main() {char str[][20]={"One*World","One*Dream!"},*p=str[1];
有以下程序 #include<stdio.h> #include<string.h> void main() {char str[][20]={"One*World","One*Dream!"},*p=str[1];
admin
2019-04-24
22
问题
有以下程序
#include<stdio.h>
#include<string.h>
void main()
{char str[][20]={"One*World","One*Dream!"},*p=str[1];
printf("%d,",strlen(p));
printf("%s\n",p);}
程序运行后的输出结果是
选项
A、9,One*Dream!
B、10,One*Dream!
C、9,One*World
D、10,One*World
答案
B
解析
在主函数中定义了二维字符数组str,并对它赋初值。定义字符指针p,并把字符串str[1]的地址赋给它。所以这时字符指针p指向字符串“One*Dream!”,然后在两个输出语句中,分别输出这个字符串的长度10和字符串本身。
转载请注明原文地址:https://jikaoti.com/ti/SJf0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列叙述中,不符合良好程序设计风格要求的是
下面选项中不属于面向对象程序设计特征的是()。
以下程序运行后的输出结果是[]。main(){intm=011,n=11;printf("%d%d\n",++m,n++);}
C语言用于结构化程序设计的3种基本结构是______、选择结构和循环结构。
已知字母A的ASCII码值是65,字母a的ASCII码值是97,以下程序______。maini(){chara=’A’;intb=20;printh("%d,%o",(a=a+a,a+b,b),a+’a
随机试题
Everydreamhassomethingtodowithourfeelings,longings,wishes,needs,fears,andmemories.Butsomethingonthe"outside"
A.胸膜炎B.呼吸道感染C.肺结核D.支气管哮喘E.喉部疾病咳嗽伴胸痛见于
咨询业的社会功能有( )。
下列关于红色预警法的说法,错误的是()。
幼儿游戏的特点有()
中国民族的同一性不但远超过其他许多国家——94%的人口为汉族——并且作为一个单一的政治实体(虽然其间或有分裂中断),至少可能已有两千年历史之久。更重要的是,在两千年中华帝国岁月的绝大多数时间里,并在绝大多数关心天下事的中国人心日当中,中国是世界文明的中心与
在考生文件夹下LUY文件夹中建立一个名为BRAIN的文件夹。
Americansarefarmoresophisticatedaboutbeveragesthantheywere20yearsago.WitnesstheStarbucksrevolutionandyou’llkn
IseethisprincipalalloverasIgothroughmyday.Iseerimsoncarwheelsthatcostupwardsof$500,justforalittlebit
Angerisanemotionthatcanbedifficulttodealwith.Sometimesit’sexperiencedasafleeting【B1】______whileothertimesitc
最新回复
(
0
)