What's the proper use of printf to display pointers padded with 0s

后端 未结 9 2200
暖寄归人
暖寄归人 2021-01-31 14:32

In C, I\'d like to use printf to display pointers, and so that they line up properly, I\'d like to pad them with 0s.

My guess was that the proper way to do this was:

9条回答
  •  忘了有多久
    2021-01-31 15:11

    #include

    #include

    printf("%016" PRIxPTR "\n", (uintptr_t)ptr);

    but it won't print the pointer in the implementation defined way (says DEAD:BEEF for 8086 segmented mode).

提交回复
热议问题