1,三种初始化方法
1.先定义类型,再定义变量
strut Student{
int age;
char* name;
};
struts Student stu;
2.定义类型的同时定义变量
strut Student{
int age;
char* name;
} stu;
struts Student stu2;
3.定义类型的同时定义变量(省略了类型名称)
strut {
int age;
char* name;
} stu;
2,结构体初始化
struts Student stu={2,'name'};
stu.age=3;
struts Student stu={.name='name',.age=11};
3,结构体数组
strut Student{
int age;
char* name;
} ;
struts Student stu[3]={
{2,'name1'},
{3,'name2'},
{4,'name3'}
};
stu[0].age=9;