What is the behavior of the conversion specifier `p` with `NULL` pointer?

后端 未结 2 489
南旧
南旧 2021-01-17 11:52

I wonder if does:

void *ptr = NULL;
printf(\"%p\\n\", ptr);

Will always gives (nil) output?

Does it depend on standard

2条回答
  •  一整个雨季
    2021-01-17 12:10

    Will always gives (nil)?

    Not at all. On my machine (Mac with i686-apple-darwin11-llvm-gcc-4.2) it prints 0x0.

提交回复
热议问题