# What is the differnce between Structure and Union?

The difference between structure and union is,
1. The amount of memory required to store a structure variable is the sum of the size of all the members.
On the other hand, in case of unions, the amount of memory required is always equal to that required by its largest member.

2. In case of structure, each member have their own memory space but In union, one block is used by all the member of the union.

Detailed Example:

```1 2 3 4 5 6 struct stu { char c; int l; float p; };```
```1 2 3 4 5 6 union emp { char c; int l; float p; };```

In the above example size of the structure stu is 7 and size of union emp is 4.

### 16 Responses to “What is the differnce between Structure and Union?”

1. i talk to question you do answer

2. Jaydeep Rana

Because of giving example I clearly understand difference between structure & union about memory. Nice!

3. Prakash

Very very use full at last minute doubt clearance during exams…

4. Nice short answer in interview…
as well as
1)structure can handle more than one member at a time but in case of union it will access only one member at a time.
2)in case of structure value assigned to one member will not affect to the others because of seperate memory allocation but in case of union value afffected.(overlapping)

5. Md. Bilal

Nic answer showing clear points without ambiguising
…… Very easy for people to understand struct nd union …
Thanking u

6. the difference between the concept of structure and Unions in c language is in terms of…….?
a)speed
b)storage
c)both a and b
d)none of the above

plz give mi r8 and I m confused about option b and c