×
☰ Menu

Union in C

Like Structures, the union is a user-defined data type. In a union, all members share the same memory location

 

In C, a union is a special data type that allows multiple data types to be stored in the same memory region. We can define a union with multiple members, but at any given time, only one member can contain a value. Unions allow you to use the same memory address for various purposes in a more effective manner.