0
814views
State true or false with reason

In a union, space is allocated to every member individually.

Subject : Structured Programming Approach

Title : Arrays, String, Structures and Union

Difficulty : Medium

1 Answer
2
3views

In a union, space is allocated to every member individually. False

In union, the total memory space allocated is equal to the member with largest size. All other members share the same memory space. This is the biggest difference between structure and union.

Eg:- union student { int rollno; char gender; float marks; }s1;

In above example variable marks is of float type and have largest size (4 bytes). So the total memory required to store union variable s1 is 4 bytes.

Please log in to add an answer.