+ 3
struct vs typedef struct
What is the difference between: typedef struct Books { int book_id; } Book; and struct Book { int book_id; }; Both can be instantiated by Book book1, book2; Also, which one should be preferred, if there's a difference?
1 Answer
+ 12
https://stackoverflow.com/questions/612328/difference-between-struct-and-typedef-struct-in-c
Sounds to me like the struct keyword in C used to only define the struct object in the struct namespace, and hence typedef was used in place to create an alias to make it simpler to declare a struct object. Interesting, I never knew that.