Mask-group

Union in C



  • A user-defined data type that allows us to hold different types of elements but it does not occupy the sum of all members size.

  • It occupies the memory of the largest member only.It shares memory of the largest member.

Advantage:

  • Union occupies less memory than structures because it occupies the memory of the largest member only.

Disadvantage:

  • It can store data in one member only.