 <p>Strictly by the standard <em>type-punning</em> expect in narrow circumstances is <a href="http://en.wikipedia.org/wiki/Undefined_behavior" rel="nofollow">undefined behavior</a> but in practice many compilers support it for example <a href="http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Optimize-Options.html#Type-punning" rel="nofollow">gcc manual points here for type-punning</a> and under <em>-fstrict-aliasing</em> section is says:</p> <blockquote> <p>The practice of reading from a different union member than the one most recently written to (called “type-punning”) is common. Even with -fstrict-aliasing, type-punning is allowed, provided the memory is accessed through the union type.</p> </blockquote> <p>I would recommend reading <a href="http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html" rel="nofollow">Understanding Strict Aliasing</a> if you plan on using <em>type-punning</em> a lot.</p> <p><code>y.b</code> has the value <code>b</code> since all the elements of the union share memory and you initialized <code>y</code> with <code>100</code> which in <em>ASCII</em> is <code>b</code>. This is the same reason why the other fields of <code>x</code> change when you modify one including the case of <code>strcpy</code> and depending on your compiler this may be undefined or well defined(<em>in the case of gcc it is defined</em>).</p> <p>For completeness sake the C++ draft standard section <code>9.5</code> <em>Unions</em> paragraph <em>1</em> says(<em>emphasis mine</em>):</p> <blockquote> <p>In a union, <strong>at most one of the non-static data members can be active at any time</strong>, that is, the value of at most one of the non-static data members can be stored in a union at any time. [ Note: One special guarantee is made in order to simplify the use of unions: If a standard-layout union contains several standard-layout structs that share a common initial sequence (9.2), and <strong>if an object of this standard-layout union type contains one of the standard-layout structs, it is permitted to inspect the common initial sequence of any of standard-layout struct members</strong>; see 9.2. —end note ] The size of a union is sufficient to contain the largest of its non-static data members. Each non-static data member is allocated as if it were the sole member of a struct.</p> </blockquote>