Unions handle the same situation as FORTRAN EQUIVALENCE, where the data in a certain memory location may be treated two ways. A union declaration looks like a structure declaration, but all fields of the union occupy the same memory.
The following union allocates 32 bits of memory called location. The 32 bits may be treated as a 32 bit int by referring to location.i, or as two 16 bit shorts by referring to location.s[0] and location.s[1].
union {
short s[2];
int i;
} location;
location.s[0] = 2;
location.s[1] = 112;
location.i = 2*65536 + 112; // this has the same effect as the previous 2 stmts