Embed presentation
Downloaded 95 times






Union in C allows defining a data type that contains multiple members of different data types that share the same memory location. The size of the memory allocated for a union is equal to the size of its largest member. Only one member can be accessed at a time since they share the same memory location. Accessing different members can corrupt the values stored as the memory is shared.
Unions in C are similar to structures with shared memory storage. Only the largest member is stored, limiting concurrent member use.
A union can contain multiple members, but only one can be accessed at a time. Memory allocation is based on the size of the largest member.
Accessing union members is done similarly to structures, maintaining a uniform syntax for member access.
In a union, shared memory can cause data corruption for non-active members, showing how only the currently stored member retains valid data.





