Typedef struct {
int a;
Int b;
} stu. So why can define, struct without the structure of ah, this and struct {int a;
Int b;
} stu. What's the difference
CodePudding user response:
The
^ * ^ reply: refer to the original poster fat beef typedef struct { int a; Int b; } stu. So why can define, struct without the structure of ah, this and struct {int a; Int b; } stu. What is the difference between Behind the struct is structure label, it is can omit the Typedef struct { int a; Int b; } stu. - & gt; Stu is a structure type Stu ABC; - & gt; ABC is the structure variable name Struct {int a; Int b; } stu. - & gt; Stu is a structure variable name The type of Struct {int a; Int b; }; CodePudding user response:
Do not recommend such a definition, structure should not be read CodePudding user response:
Typedef struct { int a; Int b; } stu ;//is a custom type, red part is the original type (is an anonymous structure), the blue part is the new type (a type name), a new type (name) is equivalent to the original type (structure) struct { int a; Int b; } stu ;//is variable declarations, red variable type (anonymous structure, which is not the structure of the name), the blue part is a variable CodePudding user response:
Please refer to the "c + + typedef and const pointer" Wish I could help you!