Vidyalelo
C Programming · Q51

Structure and Union

Programming · C Programming · question 51

Q51

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; ptr1->x = (struct q*)&p1.x; printf("%d ", ptr1->x[1]);

A.
Compile time error
B.
Segmentation fault/code crash
Answer
C.
2
D.
1

Answer: Option B

Solution

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