Sum data type: Difference between revisions

Updated C header tags
(Added C implementation)
(Updated C header tags)
Line 40:
What follows are two example programs. In both an union stores an integer, a floating point and a character at the same location. If all values are initialized at once, data is corrupted, as shown in the first example. Proper use of unions require storing and retrieving data only when required.
 
==={{header|Incorrect usage}}===
<lang C>
#include<stdio.h>
Line 72:
</pre>
 
==={{header|Correct usage}}===
<lang C>
#include<stdio.h>
503

edits