结构体
结构体属于用户自定义的数据类型,允许用户存储不同的数据类型。
结构体的定义
# include <string>
struct Student
{
    string name;
    int age;
    int score;
}
使用结构体
struct Student s1;
s1.age = 10;
struct Student s1 = {"张三",10,100};
Student s1 = {"张三",10,100};
结构体struct关键字可以省略;
使用
.来访问成员。
结构体数组:
struct Student StuArray [] = {
    {},
    {},
    {}
}
结构体指针
Student * p = &s1
p->name