Printing null pointers with %p is undefined behavior?
问题 Is it undefined behavior to print null pointers with the %p conversion specifier? #include <stdio.h> int main(void) { void *p = NULL; printf("%p", p); return 0; } The question applies to the C standard, and not to C implementations. 回答1: This is one of those weird corner cases where we're subject to the limitations of the English language and inconsistent structure in the standard. So at best, I can make a compelling counter-argument, as it's impossible to prove it :) 1 The code in the