有以下程序#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));} 程序运行后的

admin2019-06-09  19

问题 有以下程序#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://jikaoti.com/ti/NDf0FFFM
0

相关试题推荐
最新回复(0)