首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
若有以下程序段: struct st { int n; int*m;}; int a=2,b=3,c=5; struct st s[3]=({101,&a},{102,&c),{103,&b)}; m
若有以下程序段: struct st { int n; int*m;}; int a=2,b=3,c=5; struct st s[3]=({101,&a},{102,&c),{103,&b)}; m
admin
2021-02-25
21
问题
若有以下程序段:
struct st
{ int n;
int*m;};
int a=2,b=3,c=5;
struct st s[3]=({101,&a},{102,&c),{103,&b)};
main()
{ struct st*p;
p=s;
…}
则以下表达式中值为5的是( )。
选项
A、(p++)->m
B、*(p++)->m
C、(*p).m
D、*(++p)->m
答案
D
解析
本题考查如何通过指针引用数组元素。首先定义了一个结构体,然后定义了一个结构体变量s[3],并赋了初值。在主程序中,定义了一个指向结构体变量s的指针p,要使表达式的值为5,就应该引用s[1].m的值,使指针p指向s[1],++p可以实现将p指针加1,指向s[1]。
转载请注明原文地址:https://kaotiyun.com/show/notp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下叙述中错误的是()。
软件测试的目的是
某带链的队列初始状态为front=rear=NULL。经过一系列正常的入队与退队操作后,front=10,rear=5。该队列中的元素个数为()。
以下叙述中正确的是
有以下程序#definePT3.5;#defineS(x)PT*x*x;main(){inta=1,b=2;print=f("%4.1f\n",S(a+b));}程序运行后的
C语言中的标识符分为关键字、预定义标识符和用户标识符,以下叙述中正确的是()。
软件生命周期可分为定义阶段、开发阶段和维护阶段,下面不属于开发阶段任务的是
设循环队列为Q(1:m),其初始状态为front=rear=m。经过一系列入队与退队运算后,front=15,rear=20。现要在该循环队列中寻找最大值的元素,最坏情况下需要比较的次数为()。
以下不能用于描述算法的是()。
软件调试的目的是
随机试题
诊断脾破裂最有意义的检查结果是诊断胃穿孔最有价值的检查结果是
下列是治疗积滞乳食内积证的首选方剂是
导航电子地图制作标准的特点不包括()。
幼儿天生就充满了好奇,不断探索外部世界。这说明幼儿是()。
一学生决心改掉迟到的毛病,遵守学校纪律,可冬天一到,他迟迟不肯起床,结果又迟到了。对该生的教育应该培养()。
()是保证录用人民警察素质的第一道程序。
某银行的营业厅有多个柜员窗口,可以同时办理业务。银行的营业厅中安排有n张座椅供储户休息等候。每个储户在进入营业厅时会在排队机上取得一个号码,若此前没有客户,则排队机就会唤醒一个柜员为储户服务,当没有储户时柜员便可以休息。若储户较多,则所有柜员均会参与服务,
WhenDonaldOlayerenrolledinnursingschoolnineyearsago,hisfathertookithard."Here’smyfather,asteelworker,hearing
Rubidium,potassiumandcarbonarethreecommonelementsusedtodatethehistoryofEarth.Theratesofradioactivedecayoft
Fromthefirstparagraphweknowthatpresent-dayuniversitieshavebecome______.WhatdowelearnaboutSiliconValleyfromt
最新回复
(
0
)