#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);
return 0;
}
IOS开发---C语言-⑲结构体的嵌套
最新推荐文章于 2024-06-09 12:57:22 发布