Why use two names when defining a struct? (C) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why use two names when defining a struct? (C)

Hi, so I was wondering why when, for example, in the code at the end of the message, they define a structure named "book" by using: typedef struct Books { ... } book; instead of using typedef struct { ... } book; What's the point of writing "Books" after typedef struct? Thanks in advance. https://www.tutorialspoint.com/cprogramming/c_typedef.htm

22nd Apr 2020, 4:47 PM
Joan NC
Joan NC - avatar
1 Answer
- 1
Structs are custom data types. "Books" is the name of said data type. "book" is the name of a variable of type Books.
23rd Apr 2020, 12:15 AM
Kotz
Kotz - avatar