Vidyalelo
C Programming · Q169

Structure and Union

Programming · C Programming · question 169

Q169

What will be the output of the following C code? #include union u struct p unsigned char x : 2; unsigned int y : 2; ; int x; ; int main() union u u; u.p.x = 2; printf("%d ", u.p.x);

A.
Compile time error
Answer
B.
Undefined behaviour
C.
Depends on the standard
D.
2

Answer: Option A

Solution

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