Vidyalelo
C Programming · Q98

Structure and Union

Programming · C Programming · question 98

Q98

What will be the output of the following C code? #include struct p int x; int y; ; int main() struct p p1[] = 1, 92, 3, 94, 5, 96; struct p *ptr1 = p1; int x = (sizeof(p1) / 5); if (x == 3) printf("%d %d ", ptr1->x, (ptr1 + x - 1)->x); else printf("false ");

A.
Compile time error
B.
1 5
C.
Undefined behaviour
D.
false
Answer

Answer: Option D

Solution

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