I wonder if does:
void *ptr = NULL;
printf("%p\n", ptr);
Will always gives (nil)
output?
Does it depend on standard library implementation, or it's a C99 standard specification?
I wonder if does:
void *ptr = NULL;
printf("%p\n", ptr);
Will always gives (nil)
output?
Does it depend on standard library implementation, or it's a C99 standard specification?
Not at all. On my machine (Mac with
i686-apple-darwin11-llvm-gcc-4.2
) it prints0x0
.On my system it yields
(null)
so I guess it's implementation defined. More generally, everything%p
prints is implementation-defined: