Where is `%p` useful with printf?

后端 未结 7 1567
鱼传尺愫
鱼传尺愫 2020-11-27 03:10

After all, both these statements do the same thing...

int a = 10;
int *b = &a;
printf(\"%p\\n\",b);
printf(\"%08X\\n\",b);

For example

7条回答
  •  误落风尘
    2020-11-27 03:35

    The size of the pointer may be something different than that of int. Also an implementation could produce better than simple hex value representation of the address when you use %p.

提交回复
热议问题