Vidyalelo
C Programming · Q216

Pointer

Programming · C Programming · question 216

Q216

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

A.
1
B.
4
Answer
C.
Compile time error
D.
Depends on the compiler

Answer: Option B

Solution

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