A union is a user-defined data type in which all members share the same memory location.
Structure allocates separate memory for each member
Union allocates memory equal to the largest member only
Use dot (.) operator
Memory-efficient programming
Embedded systems
Handling multiple data types in same memory
An enumeration (enum) is a user-defined data type that assigns names to integer constants.
Improves code readability
Reduces use of numeric constants
Easy maintenance
Union shares memory among members
Structure vs Union differ in memory allocation
Enumeration represents named integer constants
Both are user-defined data types
Take quizzes related to this topic and see where you stand!
Start Quiz Now