It took me some long time to comprehend the issues involved in using unions, structs, and bit fields in C and C++.
First, for the definition of unions and structs, take a look at this link:
Unions could be used together with structs to reinterpret the same location in memory with different interpretations (similar in spirit to the C++ reinterpret_cast). For examples on this see:
C++ extends the unions and structs, for example see:
Bit fields are used to define special-sized integers. This is useful for packing data (e.g. flags) together into one memory location. This, however, is a bad habit and should be avoided as the compiler-generated code to access bit fields is usually inefficient! For more examples on this, see:
Finally, unions and structs could be anonymous! You do not have to give a name to a union. In this case its members become directly accessible within the same scope. Wikipedia calls this "untagged union". For an example see: