本帖最后由 旧时光放映机 于 2025-4-5 21:16 编辑
1. 先定义结构体类型,再定义结构体变量
- // 定义结构体类型
- struct Student {
- char name[50];
- int age;
- float score;
- };
- struct Student stu1;
2.定义结构体类型的同时定义结构体变量
- // 定义结构体类型的同时定义结构体变量
- struct Student {
- char name[50];
- int age;
- float score;
- } stu1;
3. 匿名结构体- struct {
- char name[50];
- int age;
- float score;
- } stu1;
|