C struct v union in embedded programming - why?
The use of a UNION permits formatting a particular storage allocation to different variable types or layouts. This can be used to advantage in a number of ways. Here are a couple of examples.


You have a UNION that defines the various record layouts for packets of data that arrive from a communication channel.
You can use the UNION to efficiently unpack data from one variable type to another such as overlaying a "uint_32" with a "uint_8[4]" to unpack bytes from a dword.