《C语言编程学习课件 (53).pdf》由会员分享,可在线阅读,更多相关《C语言编程学习课件 (53).pdf(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、Programming In CProgramming In C Contents 01 02 Structure nesting Structure array Student Student NumberNumber NameName SexSex BirthdayBirthday Year Month Day 160501 John M 1997 2 3 160502 Rose F 1998 4 6 160503 Smith M 1997 8 9 Structure nesting The soThe so-called structure nesting means that,the
2、data type of a structure called structure nesting means that,the data type of a structure member can also be a structure.member can also be a structure.struct Date int year;int month;int day;Structure nesting struct Student char ID7;char name10;char sex;struct Date birthday;s1;/Data Type/Data Type /
3、Birthday/Birthday member is definedmember is defined:s2.birthday.year=1998;members members initialization initialization:struct Student s2=“160503”,“Smith”,M,;struct Student s2=“160503”,“Smith”,M,1997,8,9;1997,8,9 struct Student char ID7;char name10;char sex;struct Date birthday;Structure array/stru
4、cture array s2 with a length of 10/structure array s2 with a length of 10 s210 struct Student s110;/structure array s1 with a length of 10/structure array s1 with a length of 10 Structure array After defining the structure array,we can refer the structure array elements.Next,we continue to look at this example to understand the use of structure array.Programming In CProgramming In C