开发者

Format Specifier in C

What does %p format specifier in C means? How does it get interpreted in a printf statement?

For example, when i run the following line in GCC compiler,

开发者_开发百科int a=1; printf("%p",a);

the o/p i got is: 00000001 So what does the 8 digits mean?


%p - Print a void * (pointer to void) in an implementation-defined format (Source: http://en.wikipedia.org/wiki/Printf#Format_placeholders ).

Most implementations use a hexademical string representation of the value.


It means to print a value as a hexadecimal representation of a pointer. See http://linux.die.net/man/3/printf


It means the corresponding argument is a pointer.


It's for printing pointers. You pass a pointer to void; exactly how it will look when it's printed isn't specified by the standard.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜