#include <stdio.h>
struct student
{
char name[20];
struct scorestruct
{
int math;
int english;
} scores;
struct infostruct
{
float height;
float weight;
} info;
};
// 结构体嵌套
int main()
{
struct student wangyu = {"Wang wu", {80, 96}, {175, 80}};
printf("wangwu's name: %s\n", wangyu.name);
printf("wangwu's math scores: %d\n", wangyu.scores.math); // 双层内容访问
printf("wangwu's english scores: %d\n", wangyu.scores.english);
printf("wangwu's height: %.1f cm\n", wangyu.info.height);
printf("wangwu's weight: %.1f kg\n", wangyu.info.weight);
}