你的位置:首页 > 软件开发 > 操作系统 > 【学习笔记】【C语言】结构体的嵌套

【学习笔记】【C语言】结构体的嵌套

发布时间:2015-06-29 22:00:06
1 #include <stdio.h> 2 3 int main() 4 { 5 struct Date 6 { 7 int year; 8 int month; 9 int day;10 };11 12 13 // ...
 1 #include <stdio.h> 2  3 int main() 4 { 5   struct Date 6   { 7     int year; 8     int month; 9     int day;10   };11   12   13   // 类型14   struct Student15   {16     int no; // 学号17     18     struct Date birthday; // 生日19     20     struct Date ruxueDate; // 入学日期21     22     // 这种写法是错误的23     //struct Student stu;24   };25   26   27   struct Student stu = {1, {2000, 9, 10}, {2012, 9, 10}};28   29   printf("year=%d,month=%d,day=%d\n", stu.birthday.year, stu.birthday.month, stu.birthday.day);30   31   32   33   34   35   return 0;36 }

原标题:【学习笔记】【C语言】结构体的嵌套

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录