What is the difference between following two typedef statements? 1. typedef struct {int x; int y;} Point; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between following two typedef statements? 1. typedef struct {int x; int y;} Point;

the second statement is : 2. typedef struct Pt {int x; int y;} Point; I hope the question is clear.

28th Feb 2017, 4:59 PM
Utsuk Smile
Utsuk Smile - avatar
1 Answer
0
Using the second statement, you can use the type struct Pt as it is declared before the typedef. In the first statement you use an anonymous structure so you will only be able to use it after (you will use Point). The second statement is used for structures that use themselves as attributes.
28th Feb 2017, 5:17 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar