The Online Solitaire Game That's Entertaining Minds of All Ages
Distinguish, differentiate, compare and explain what is the difference between Structure and Union. Comparison and Differences.
Differences between Structure and Union
S.No. | Structure | Union |
1 | Every member has its own memory sapce. | All the members use the same memory space to store the values. |
2 | It can handle all the members(or) a few as required at a time. | It can handle only one member at a time,as all the members use the same space. |
3 | Keyword struct is used to declare. | Keyword union is used to declar. |
4 | It may be initialized with all its members. | Only its first member may be initialized. |
5 | Any member can be accessed at any time without the loss of data. | Only one member can be accessed at any time with the loss of previous data. |
6 | Different interpretation for the same memory location are not possible. | Different interpretations for the same. |
7 | More storage space is required. | Minimum storage space is required. |
8 | Syntax: structure strut-name { }varl..varn; |
Syntax: union union-name { }varl..varn; |
Tags:
Difference between Union vs Structure
Structure vs Union
Differences between Union vs Structure
Image Credits: Freepik