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
34
问题
有以下程序#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(){FILE*f;f=fopen("filea.txt","w");fprintf(f,"abc");fclose(f);)若文本文件filea.tx
下面选项中关于“文件指针”概念的叙述正确的是
有以下程序main(){unsignedchara=8,c;c=a>>3;printf("%d\n",c);}程序运行后的输出结果是
若有以下程序段structst{intn;structst*next;);structsta[3]={5,&a[1],7,&a[2],9,’\0’),*p;p=&a[0];则以下选项中值为6的表达式是
有以下程序#includestructord{intx,y;)dt[2]={1,2,3,4);main(){structord*p=dt;printf("%d,",++(p->x));printf("%d\n",++(p->y));}
以下叙述中错误的是
有以下程序#includemain(){intaft={10,20,30,40},*p=a,i;for(i=0;i<=3;i++){a[i]=*p;p++;)printf("%d\n",a[2]
以下叙述中正确的是
随机试题
HowtoImproveaChild’sAppetiteMostchildrenwith【C1】______(health)appetitesarereadytoeatalmostanythingthatiso
目前门控心肌显像采集时,通常将一个心动周期分成多少等份
肠结核肠道易激综合征
秦汉时代表示威仪登第的建筑物是()。
都某与某企业签订劳动合同,下列关于都某试用期的约定,有效的是()。
下列四句话中,表达有歧义的一句是:
公共生活超越了私人生活的局限,具有鲜明的开放性和透明性,对他人和社会的影响更为直接和广泛。当代社会公共生活的特征主要表现在()
设线性方程组 有非零解,则组成基础解系的线性无关的解向量有().
Theeffectofthebabyboomontheschoolshelpedtomakepossibleashiftinthinkingabouttheroleofpubliceducationinthe
A、IlikeChinesefood.B、It’snotmybusiness.C、Idon’tlikefish.D、Itdoesn’tworkforme.D本题考查对Whynot引导的提出建议的特殊疑问句的回答。题目问:
最新回复
(
0
)