Given something like (adapted from another post):
struct {
union {
struct {
float x, y, z;
};
float xyz[3];
};
int a;
} v = { /* what goes here? */ };
how do I initialize it in place? I know I have to use a designated initializer for the xyz
member, but do I have to do the same if I want the first set of members instead?
...
Looking at yet another post, its examples deal only with anonymous structs, and not unions, but I guess the syntax would be
//...
} v = { someX, someY, someZ, someA };
which initializes the three members of the first variant of the union, then the int
that follows the entire union part. Is this right?