如果变量是定义成一般的结构体变量,用.如果变量是定义成结构体指针变量,则用-> 即定义了一个结构体的变量(实例)后可以用.直接调用其内部成员。而定义成结构体的指针则需用指针->来访问成员。 例如: struct student { char name[8]; int score; }; struct student
p, *q; int x; x = p.score; x = q-> score;
结构体变量
最新推荐文章于 2021-12-11 16:01:59 发布