首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

大家看看这个输出是什么%#p,多谢

2013-04-05 
大家看看这个输出是什么%#p,谢谢printf(a_ptr%#p,p_ptr%#p\n,&a[4][2],&p[4][2])%#p是啥啊[解决办法]

大家看看这个输出是什么%#p,谢谢
printf("a_ptr=%#p,p_ptr=%#p\n",&a[4][2],&p[4][2]);

%#p是啥啊
[解决办法]
代表了在输出的地址前面加 0X
[解决办法]
       #      Specifies that the value is to be converted to an alternative form.  For o conversion,  it  increases  the
              precision  (if  necessary) to force the first digit of the result to be zero. For x or X conversion speci-
              fiers, a non-zero result shall have 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g, and  G  conversion
              specifiers,  the result shall always contain a radix character, even if no digits follow the radix charac-
              ter. Without this flag, a radix character appears in the result of these conversions only if a digit  fol-
              lows  it.  For  g and G conversion specifiers, trailing zeros shall not be removed from the result as they
              normally are.  For other conversion specifiers, the behavior is undefined.


       p      The argument shall be a pointer to void. The value of the pointer is converted to a sequence of  printable
              characters, in an implementation-defined manner.
[解决办法]
是很少见的一个用法,放到程序里去试一下也就认识它了 
输出了一个0X开头的8位16进制数 比如 0X0012FE7C 
[解决办法]
%p是正确的
但是%#p是不对了。

热点排行