有以下程序 struct S{int a;int b;}; main(){struct S a,*p=&a; a.a=99; printf("%d\n",_______);} 程序要求输出结构体中成员a的数据,以下不能填入横线处的内容是

admin2018-11-21  21

问题 有以下程序
struct S{int a;int b;};
main(){struct S a,*p=&a;
a.a=99;
printf("%d\n",_______);}
程序要求输出结构体中成员a的数据,以下不能填入横线处的内容是

选项 A、a.a
B、*p.a
C、p->a
D、(*p).a

答案B

解析 如果p指向结构体,那么下面三种形式都可以访问结构体的成员:结构体变量.成员名、(*p).成员名、p->成员名。
转载请注明原文地址:https://kaotiyun.com/show/pYxp777K
0

最新回复(0)