This is a discussion on Unions? within the C++ Programming
forums, part of the General Programming Boards category; Okay so
i'm reading through my programming book and come back across the
forgotten union. I'm sitting here reading it ...    1. #1
Registered User     Join Date     May 2002       Okay so i'm
reading through my programming book and come back across the
forgotten union. I'm sitting here reading it thinking, when, at
least in console based c++ are unions actually useful? I can
understand them if you have a huge program that accesses memory
alot, but this doesn't seem feasible at least in the console.
Can anyone provide a decent example of when this might actually
be used?     Oi Oi Oi!!!!    2. #2     Join Date     Aug 2001
Groningen (NL)     Unions are very useful. Just an example: you
can define a bitfield of 8 bits and a byte declared as unsigned
char. Put those two in an union and then you can assign a
received byte to the byte in the union and with the bitfield in
the union you can ac