Multiple choice technology programming languages

main() { int *p1, i=25; void *p2; p1=&i; p2=&i; p1=p2; p2=p1; printf(“%d”,i); }

  1. error

  2. 25

  3. will not complie

  4. some memory address

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In C, a void pointer (void*) can be implicitly assigned to any other pointer type without explicit casting. This is a special property of void pointers. After p1=p2 and p2=p1, both pointers still point to i, which holds value 25. The printf correctly outputs 25. The 'will not compile' distractor is incorrect because void* to other pointer assignment is valid in C.