A union is a user-defined data type that allows you to store different data types in the same memory location. Unlike structures, which allocate memory for each member separately, unions allocate enough memory to hold the largest member. This means that all members share the same memory space.
Program.c
Value of intValue: 42 Value of floatValue: 3.140000 Value of stringValue: Hello, Union! Size of MyUnion: 20 bytes Size of intValue: 4 bytes Size of floatValue: 4 bytes Size of stringValue: 20 bytes
With supporting text below as a natural lead-in to additional content.