main()
{
struct student
{
char number[6];
char name[20];
char sex;
int age;
float score;
}s1={"12004","李明",'m',19,298.3},
s2={"12005","王丽",'f',18,227.9},*p=&s1;
printf("学号 姓名 性别 年龄 分数\n");
printf("\n");
printf("%s %s %c %d %f\n",
p->number,p->name,p->sex,p->age,p->score);
p=&s2; /*指针p指向s2*/
printf("%s %s %c %d %f\n",
p->number,p->name,p->sex,p->age,p->score);
}
{
struct student
{
char number[6];
char name[20];
char sex;
int age;
float score;
}s1={"12004","李明",'m',19,298.3},
s2={"12005","王丽",'f',18,227.9},*p=&s1;
printf("学号 姓名 性别 年龄 分数\n");
printf("\n");
printf("%s %s %c %d %f\n",
p->number,p->name,p->sex,p->age,p->score);
p=&s2; /*指针p指向s2*/
printf("%s %s %c %d %f\n",
p->number,p->name,p->sex,p->age,p->score);
}