答:(*p).成员变量名 (*p) == 结构体变量
p -> 成员变量名
代码演示:#include <stdio.h>
int main(int argc,const char *argv[])
{
struct Student
{
int age;
char *name;
}
struct Student stu1 = {25,"xian san"};
struct Student *p = &stu1;
//第一种方式
printf("%d ,%s\n",(*p).age,(*p).name);
//第二种方式
printf("%d,%s\n",p ->age,p->name);
return 0;
}
|
|