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
60
问题
有以下程序#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(
有以下程序#includemain(){FILE*f;f=fopen("filea.txt","w");fprintf(f,"abc");fclose(f);)若文本文件filea.tx
下面选项中关于“文件指针”概念的叙述正确的是
若变量已正确定义,则以下语句的输出结果是s=32;s^=32;printf("%d",s);
有以下程序,#include<stdio.h>#include<string.h>StmctA{inta;charb[10];doublec;};structAf(structAt
以下叙述中错误的是
以下结构体说明和变量定义中,正确的是
有以下程序#includemain(){intaft={10,20,30,40},*p=a,i;for(i=0;i<=3;i++){a[i]=*p;p++;)printf("%d\n",a[2]
以下叙述中正确的是
有下列程序:inta=4;intf(intn){intt=0;staticinta=5;if(n%2){inta=6;t+=a++;)else{inta=7;t+=a++;)
随机试题
血浆置换是治疗系统性红斑狼疮最主要的方法。()
A.可合并肠急性穿孔B.可合并肠大出血C.两者均有D.两者均无肠伤寒
用寒远寒,用热远热,属于()
适应于本国原材料的工艺技术与长期进口主要投入物的工艺技术,应优先选用哪一种?
总承包商在和分包商签订分包合同时,可能会制定一个误期损害赔偿条款,这是对( )的运用。
下列行政公文格式正文中的结尾部分,写法不妥当的是()。
市场体系的三大支柱是()。
内存按字节编址,地址从A4000H到CBFFFH,共有(6)字节。若用存储容量为 32K*8bit的存储器芯片构成该内存,至少需要(7)片。
有以下程序voidfun1(char*p)main(){char*q;{chara[]={"Program"},*p;q=p;p=&a[3];fun1(p);printf("%s\n",a);while(*q!=’\0’)}{
AImportanceofClassroomLearningBTelevision--ARichSourceofInformationCAdvertisementsasImportantMessagesfrom
最新回复
(
0
)