Vidyalelo
C Programming · Q78

Structure and Union

Programming · C Programming · question 78

Q78

What will be the output of the following C code? #include struct p int x; char y; ; void foo(struct p* ); int main() typedef struct p* q; struct p p1[] = 1, 92, 3, 94, 5, 96; foo(p1); void foo(struct p* p1) q ptr1 = p1; printf("%d ", ptr1->x);

A.
Compile time error
Answer
B.
1
C.
Segmentation fault
D.
Undefined behaviour

Answer: Option A

Solution

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