Vidyalelo
C Programming · Q180

Pointer

Programming · C Programming · question 180

Q180

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

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

Answer: Option A

Solution

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