x));printf("%d\n",++(p->y));" />
有以下程序#include struct ord{int x,y;} dt[2]={1,2,3,4};main(){struct ord *p=dt; printf("%d,",++(p->x));printf("%d\n",++(p->y));
首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
x));printf("%d\n",++(p->y));">有以下程序#include struct ord{int x,y;} dt[2]={1,2,3,4};main(){struct ord *p=dt; printf("%d,",++(p->x));printf("%d\n",++(p->y));
有以下程序#include struct ord{int x,y;} dt[2]={1,2,3,4};main(){struct ord *p=dt; printf("%d,",++(p->x));printf("%d\n",++(p->y));
admin
2019-05-17
71
问题
有以下程序#include struct ord{int x,y;} dt[2]={1,2,3,4};main(){struct ord *p=dt;
printf("%d,",++(p->x));printf("%d\n",++(p->y));}
程序运行后的输出结果是
选项
A、4,1
B、2,3
C、3,4
D、1,2
答案
B
解析
在题目中定义了结构体ord类型的数组变量dt,并对其赋初值。在程序中定义了指向结构体ord类型的指针变量p,并且它指向变量数组dt的第一个元素dt[0],所以此时成员变量p->x的值等于1,成员变量p->y的值等于2,在输出时分别加1,所以输出结果为选项B。
转载请注明原文地址:https://kaotiyun.com/show/TPRp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
若有以下程序#includemain(){inta=1,b=2,c=3,d=4;if((a=2)‖(b=1))c=2;if((c==3)&&(d=-1))a=5;printf(
以下叙述中正确的是
下面选项中关于“文件指针”概念的叙述正确的是
若有以下程序typedefstructstu{charname[10],gender;intscore;}STU;voidf(char*P){strcpy(p,"Qian");}main(){STUa
有以下程序#include#include"string.h"typedefstruct{charname[9];charsex;floatscore[2];}STU;voidf(STUa){
有以下程序#includestructord{intx,y;)dt[2]={1,2,3,4);main(){structord*p=dt;printf("%d,",++(p->x));printf("%d\n",++(p->y));}
以下叙述中错误的是
以下叙述中错误的是
以下叙述中正确的是
随机试题
子宫动脉源于________,其距________内口水平________cm处横跨输尿管而达子宫,分为________、________两支,分别称为________支及________支。
哮证缓解期治疗要点是治虚喘的治疗要点是治
水电站厂房施工中属二期混凝土的部分有()。
下列物质的燃烧属于表面燃烧的有()。
个人独资企业的投资者()。
当员工不理解工作内容时就会产生()
根据企业定价优先考虑要素不同,企业定价方法主要有()。
Everyday,theyslowlyaccumulate.Platescoveredinsaucesandbreadpieces.Bowlswithafinelayerofwho-knows-what.Forks,
文化教育学和批判教育学的共同之处是
AbreakthroughintheprovisionofenergyfromthesunfortheEuropeanEconomicCommunity(EEC)couldbebroughtforwardbyup
最新回复
(
0
)