结构体嵌套
#include <stdio.h>
struct STUDENT
{
int studentID;
char studentName[10];
char studentSex[4];
};
typedef struct STUDENT Student;
struct CLASS
{
int classID;
char className[10];
Student student;
};
typedef struct CLASS Class;
int main(){
Student stu;
stu.studentID=1;
strcpy(stu.studentName,"xiaoming");
strcpy(stu.studentSex,"男");
Class java;
java.classID=1;
strcpy(java.className,"单片机");
java.student=stu;
printf("%d\n%s\n%s",java.student.studentID,
java.student.studentName,java.student.studentSex);
return 0;
}