Advertisements
Advertisements
Question
Differentiate between structure and union.
Distinguish Between
Solution
Sr. NO. | Structure | Union |
1. | Memory allotted to structure is equal to the space require collectively by all the members of the structure. | Memory allotted for a union is equal to the space required by the largest memory of that union |
2. | Data is more secured in structure. | Data can be corrupted in a union. |
3. | Structure provide ease of programming. | Unions are comparatively difficult for programming. |
4. | Structures require more memory. | Unions require less memory. |
5. | Structure must be used when information of all the member elements of a structure are to be stored. | Unions must be used when only one of the member elements of the union is to be stored. |
shaalaa.com
Union
Is there an error in this question or solution?