Printing a void* variable in C

前端 未结 3 763
再見小時候
再見小時候 2021-02-01 05:55

Hi all I want to do a debug with printf. But I don\'t know how to print the \"out\" variable.

Before the return, I want to print this value, but its type is void* .

3条回答
  •  你的背包
    2021-02-01 06:35

    The format specifier for printing void pointers using printf in C is %p. What usually gets printed is a hexadecimal representation of the pointer (although the standard says simply that it is an implementation defined character sequence defining a pointer).

提交回复
热议问题