Cast a Pointer to void* When Printing Through printf
摘要
When printing out a pointer’s value (the memory address it points to) using a printf function and a %p format specifier, we need to cast that pointer to type void* first. Simply trying to print out the pointer value through printf causes undefined behavior. Example: