Zookeeper
The code shows several types of struct in the past few days. The structure declaration is as follows:
Struct book {
String name;
Int price;
Int num;
};
The format of this structure definition structure variable is as follows:
Struct book student;
Struct book {
String name;
Int price;
Int num;
} Student;
This form indicates that the process of declaring the structure and the process of defining the structure variables are merged into one step.
Typedef struct (book) {// book can be omitted
String name;
Int price;
Int num;
} Student;
Typedef is used to create a name for an existing type. The format of the struct variable defined for this structure is: Student;
I personally think that the last one is more convenient in writing, When you define a large number of struct variables in the program.
Zookeeper
Variable struct in C: struct typedef