#include <stdio.h>
int main()
{
struct student
{
long id;
char name[20];
char sex;
float score;
};
struct student stu1={1001,"狂徒张三",'M',89};
//指针p指向结构体变量
struct student *p;
p = &stu1;
//三种方式调用结构体变量的值
printf("%d %s %s %f",stu1.id,stu1.name,(stu1.sex)=='M'?"男":"女",stu1.score);
printf("\n");
printf("%d\n",(*p).id); //*p一定要带括号,不带括号的意思是*(p.id) .的优先级比*大
printf("%c\n",p->sex); // -> 结构体成员运算符
return 0;
}