3.在上述stu结构体定义中,所有的成员都是基本数据类型或数组类型。成员也可以又是一个结构体,即构成了嵌套的结构体。
如,有以下结构体定义:
struct date
{ int month;
int day;
int year;
};
struct
{ int num;
char name[20];
char sex;
struct date birthday;
float score;
}student1,student2;
首先定义一个结构体date,由month(月)、day(日)、year(年) 三个成员组成。
在定义并说明变量student1和student2时,其中的成员birthday被说明为data结构体类型。