A struct groups related fields under one name. p.x and p.y belong together.
A struct is a bundle of related fields under one name. A point is not two lonely ints; it is x and y that belong together. You reach a field with a dot: p.x.
type
field
field
3 4
Each step highlights the matching C line. Program output appears only when a line that prints actually runs.
Five questions. Pick one answer each, then Check answers. The correct choice turns green.
1. p.x is:
Dot.
2. This lesson prints:
Both fields.
3. Fields of a struct:
Group related data.
4. q->x is used when q is:
Arrow.
5. typedef struct Point Point lets you write:
Shorter type name.