Q186
What will be the output of the following C code? #include struct p int x[2]; ; struct q int *x; ; int main() struct p p1 = 1, 2; struct q *ptr1 = (struct q*)&p1; ptr1->x = (struct q*)&p1.x; printf("%d ", ptr1->x[0]);
A.
Compile time error
B.
Undefined behaviour
AnswerC.
Segmentation fault/code crash
D.
1
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board