Vidyalelo
C Programming · Q199

Pointer

Programming · C Programming · question 199

Q199

What will be the output of the following C code? #include int main() void *p; int a[4] = 1, 2, 3, 8; p = &a[3]; int *ptr = &a[2]; int n = p - ptr; printf("%d ", n);

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

Answer: Option B

Solution

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