 <p>A good usage would be to implement a chunk to translate to-and from-base64 or any unaligned data structure.</p> <pre><code>struct { unsigned int e1:6; unsigned int e2:6; unsigned int e3:6; unsigned int e4:6; } base64enc; //I don't know if declaring a 4-byte array will have the same effect. struct { unsigned char d1; unsigned char d2; unsigned char d3; } base64dec; union base64chunk { struct base64enc enc; struct base64dec dec; }; base64chunk b64c; //you can assign 3 characters to b64c.enc, and get 4 0-63 codes from b64dec instantly. </code></pre> <p>This example is a bit naive, since base64 must also consider null-termination (i.e. a string which has not a length <code>l</code> so that <code>l</code> % 3 is 0). But works as a sample of accessing unaligned data structures.</p> <p>Another example: Using this feature to <strong>break a TCP packet header into its components</strong> (or other network protocol packet header you want to discuss), althought it is a more advanced and less end-user example. In general: this is useful regarding PC internals, SO, drivers, an encoding systems.</p> <p>Another example: analyzing a <code>float</code> number.</p> <pre><code>struct _FP32 { unsigned int sign:1; unsigned int exponent:8; unsigned int mantissa:23; } union FP32_t { _FP32 parts; float number; } </code></pre> <p>(Disclaimer: Don't know the file name / type name where this is applied, but in C this is declared in a header; Don't know how can this be done for 64-bit flaots since the mantissa must have 52bits and -in a 32bit target- ints have 32 bits).</p> <p><strong>Conclusion:</strong> As the concept and these examples show, this is a rarely used feature because it's mostly for internal purposes, and not for day-by-day software.</p>