c++ 数据结构
https://www.runoob.com/cplusplus/cpp-data-structures.html
定义结构
struct 语句的格式如下:
struct type_name {
member_type1 member_name1;
member_type2 member_name2;
member_type3 member_name3;
...} object_names;
例:
struct Books {
char title[50];
char author[50];
char subject[100];
int book_id;
} book;
访问结构成员
为了访问结构的成员,我们使用成员访问运算符(.)
指向结构的指针
您可以定义指向结构的指针,方式与定义指向其他类型变量的指针相似
struct Books *struct_pointer;
为了查找结构变量的地址,请把 & 运算符放在结构名称的前面,如下所示:
struct_pointer = &Book1;
为了使用指向该结构的指针访问结构的成员,您必须使用 -> 运算符,如下所示:
struct_pointer->title;

浙公网安备 33010602011771号