union mixer{ unsigned u_val; float f_val; };
In normal programming there is a danger of mixing up the two uses of the value being stored, confusing the unsigened integer with the floating point number.On the other hand, it may be useful in some low level programs to manipulate the bits within a floating point number, for instance when moving from one machine's floating point representation to that of another machine. Note that explicit conversion to unsigned using the cast operator would involve converting the numerical value of the float and so would cause the bits to be re-arranged.
struct car_part { char * name; char * maker: union { int capacity; char * style: struct radio rpt; } }; struct car_part cp;Write an assignment to the name, capacity and radio's min_freq fields in cp.
cp.name = "Mondeo"; cp.capacity = 1798; cp.rpt.min_freq = 194;