Can a union be initialized in the declaration?

Use an initializer list:

U_U32_F u = { 0xffffffff };

You can set other members than the first one via

U_U32_F u = { .f = 42.0 };

Note that per-member union initialization doesn't work on pre-C99 compilers, of which there is a depressing number out there. The current Microsoft C compiler doesn't support it, for example. (I vaguely recall it doesn't even support first-member initialization, which goes back to K&R II, but I might be wrong about that.)


Try U_U32_F u = {0xffffffff};