.
Structure |
Union |
A structure can store multiple values of the different members. |
A union stores one value at a time for all of its members. |
A structure's total size is the sum of the size of every data member. |
A union's total size is the size of the largest data member. |
User can access or retrieve any member at a time. |
User can access or retrieve only one member at a time. |
You can use a struct keyword to define a structure. |
You can use a union keyword to define a union. |
It occupies space for each and every member written in inner
parameters. |
It occupies space for a member having the highest size written in
inner parameters. |
It supports flexible array. |
It does not support a flexible array. |
|
Comments
Post a Comment