错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Cast a Pointer to void* When Printing Through printf

  • Slobodan Dmitrović

摘要

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: