typedef struct {
int x, y;
} Point;
typedef struct {
int width, height;
} Size;
typedef struct {
Point point;
Size size;
} Rect;
Rect rect = {{3, 4}, {10, 12}};
int y = rect.point.y;
//y is 4
//a nested struct is a value: = copies it whole
Point corner = rect.point;
//corner is (3, 4)
rect.size.width = 20;
//rect.size.width is 20
//designators reach the fields of a nested struct
Rect square = {.point = {1, 1}, .size.width = 5, .size.height = 5};
//square.size.height is 5
printf("y is %d\n", y);
printf("corner is (%d, %d)\n", corner.x, corner.y);
printf("rect.size.width is %d\n", rect.size.width);
printf("square.size.height is %d\n", square.size.height);