单选题
有以下程序:
#include <stdio.h>
struct
ord
{ int x,y;} dt[2]={11,12,13,14};
main()
{
struct ord *p=dt;
printf("%d,",++(p->x));printf("%d/n",++(p->y));
}
程序运行后的输出结果是
- A. 11,12
- B. 12,13
- C. 13,14
- D. 14,11
【正确答案】
B
【答案解析】[解析] 本题中定义了一个结构体数组dt[2],其中dt[0].x=11,dt[0].y=12,dt[1].x=13,dt[1].y=14。在main函数中指针p指向了结构体数组的第一个元素,因此p->x值为11,p->y值为12,自加运算的结果分别为12和13。