What Is Structure And Union? How To Deferent Union By Structure. What Is Deference Between Them?
Structure: – Structure is a user-defined data type that included different types of data in a group. The structure cannot be shared with the memory. The structure memory size is the total of all data types.
Union: – the union same to the same structure but the difference between it. The structure cannot share the memory and the union can share the memory. The union memory size depends upon the large size of data types.
How To Deferent Union By Structure
The union is different by structure the union can share memory. And the structure cannot be shared with the memory. Otherwise, the union and structure are also the same.
Deference Between Union And Structure
| Union | Structure |
|
The union is the default data type. It is user-defined data type. It makes by the user. |
The structure is the default data type. And it is a user-defined data type. It makes by the user. |
|
Combination of many data type. |
Combination of many data type . |
|
Size = a large number of data types |
Size = total number of data types |
|
The union can share memory. |
The structure cannot be share memory. |
|
Contain lager memory because every data types having own memory. |
Contain only sufficient memory because it shares memory. |