1 定义:
struct Book{
unsigned int bookNo;
string name;
};
2 初始化
struct的初始化分为三种:逐一赋值,顺序赋值,乱序赋值
// 逐一赋值:
Book book; book.bookNo = 123; book.name = "iam a book";
// 顺序赋值
Book book1 = {12, "book1"};
// C++风格的乱序赋值
Book book2 = {
bookNo:123,
name:"book2" };
// C风格的乱序赋值
Book book3 = {
.bookNo=123,
.name="book3" };