有以下程序: #include<stdio.h> struet ord {int x,y;}dt[2]={1,2,3,4}; main() { struct ord*p=dt; printf("%d,",++(p->x)); printf("%d\n",+

admin2020-04-18  18

问题 有以下程序:
#include<stdio.h>
struet 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、3,4
B、4,1
C、2,3
D、1,2

答案C

解析 本题考查结构体数组的相关操作,dt为结构体数组,那么指针p指向了结构体数组的一个元素,所以p->x为1,p->y为2,结果为2,3。选项C正确。
转载请注明原文地址:https://kaotiyun.com/show/S3Cp777K
0

最新回复(0)