typedef struct {
int width, height;
} Size;
typedef struct {
int top, left;
} Point;
typedef struct {
Size size;
Point point;
} Rectangle;
//В C нет конструкторов: поля получают значения из списка инициализаторов
Rectangle rect = {{10, 10}, {5, 5}};
//или по именам полей в любом порядке; пропущенные поля равны нулю
Rectangle other = {.point = {.left = 5}, .size = {.width = 20, .height = 10}};
//other.point.top is 0
//{} обнуляет все поля (C23)
Rectangle empty = {};
printf("rect.size.height is %d\n", rect.size.height);
printf("other.size.width is %d\n", other.size.width);
printf("other.point.top is %d\n", other.point.top);
printf("empty.size.width is %d\n", empty.size.width);