Differentiate between structure and union.

Answers

This answer is not selected as best answer. This answer may not be sufficient for exam.

Your limit has been exceed. We have implemented this system because, We got difficulty on managing our servers. Please donate some amount to remove this limit.

Quota: 0 / 30

Donate
Structure Union
You can use a struct keyword to define a structure. You can use a union keyword to define a union.
Every member within structure is assigned a unique memory location. In union, a memory location is shared by all the data members.
Changing the value of one data member will not affect other data members in structure. Changing the value of one data member will change the value of other data members in union.
It enables you to initialize several members at once. It enables you to initialize only the first member of union.
The total size of the structure is the sum of the size of every data member. The total size of the union is the size of the largest data member.
It is mainly used for storing various data types. It is mainly used for storing one of the many data types that are available.
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.
You can retrieve any member at a time. You can access one member at a time in the union.
It supports flexible array. It does not support a flexible array.
If you found any type of error on the answer then please mention on the comment or submit your new answer.
Leave your Answer:

Click here to submit your answer.

Discussion
0 Comments
  Loading . . .