Usage of void pointers across different platforms
问题 I have heard that pointers should first be cast to void to ensure consistency of values across different platforms and should use %p format specifier. Why is it and what exactly are the problems? int x=100; int *pi=&x; printf("value of pi is: %p",(void*)pi); 回答1: printf is a variadic function and must be passed arguments of the right types. The standard says %p takes void * . Implicit cast doesn't take place for variadic functions. Quoting from N1570 7.21.6.1 The fprintf function p : The