> <i>Any access of memory using a union, where the union includes the effective type of the memory is legal. Consider:</i><p><pre><code> union {
int i;
float f;
} *u;
float f = 3.14;
u = &f;
x = u->i;
</code></pre>
> <i>In this case the memory pointed to by “u” has the declared effective type of int, and given that “u” is a union that contains int, the access using the “i” member is legal. It’s noteworthy in this that the “f” member of the union is never used, but only there to satisfy the requirement of having a member with a type compatible with the effective type.</i><p>Is this a typo? Should it say "declared effective type of <i>float</i>" and "“u” is a union that contains <i>float</i>"?<p>It's interesting to see type-punning using a union - I've read that it should be avoided and to use `memcpy` instead. Are there any issues with the union approach in C? Or is the advice to prefer `memcpy` specific to C++, where AFAICT the union approach is undefined behaviour?