If I have these structures:
typedef struct { int x; } foo;
typedef struct { foo f; } bar;
Normally you would access x
through
In C (99 and onward) you can access the common initial sub-sequence of union members, even if they weren't the last member written to1.
In C11, you can have anonymous union members. So:
typedef struct { int x; } foo;
typedef struct {
union {
foo f;
int x;
};
} bar;