struct A { int x, y; }; struct B { union { struct A 2d; struct { int x, y; }; } int z; }; ... struct B foo; foo.x = foo.2d.y = foo.z = 0;