1
1.5kviews
What is difference between Structure and Union

Subject : Structured Programming Approach

Title : Arrays, String, Structures and Union

Marks : 4M

1 Answer
0
56views
Structure Union
Declared with struct keyword Declared with union keyword
Used to represent a record. Allows storing different data types in the same memory location.
Allows combining data items of different kinds. Can define with many members, but only one member can contain a value at any given time.
The amount of memory required to store a structure variable is the sum of the size of all the members. The amount of memory required is always equal to that required by its largest member.
Each member has their own memory space One block is used by all the members of the union.
Individual member can be accessed at any time Only one member can be accessed at any given time
Several members of a structure can initialize at once. Only the first member of a union can be initialized
Please log in to add an answer.