#include <stdio.h>
int main()
{
struct Date
{
int year;
int month;
int day;
};
//类型
struct Student
{
int no;//学号
struct Date birthday; //生日
struct Date ruxueDate; //入学日期
//struct Student stu; 这种写法是错误的
};
struct Student stu = {1,{2000, 9, 10},{2012, 9, 10}};
printf("year=%d, month=%d, day=%d\n", stu.birthday.year, stu.birthday.month,
stu.birthday.day)
}
结构体的嵌套定义
最新推荐文章于 2024-07-24 15:18:49 发布