Vidyalelo
C Programming · Q12

Structure and Union

Programming · C Programming · question 12

Q12

What happens when you assign a value to one member of a union and then access another member in C?

A.
It's allowed and safe
B.
It leads to undefined behavior
Answer
C.
It raises a compilation error
D.
It swaps the values of both members

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board