关于printf输出格式%#08x的解释

代表的是在字符串前面加上0x。08表示输出8个字符。x是输出16进制

当然你也可以写成0x%08x,但是这两种是有区别的。一个输出包括0x输出8bit,而第二种包含0x输出10bit

int i = 7;
 
printf("%#010x
", i);  // gives 0x00000007
printf("0x%08x
", i);  // gives 0x00000007
printf("%#08x
", i);   // gives 0x000007

后面的x的大小写也会影响输出。

printf("%04x", 4779); // gives 12ab
printf("%04X", 4779); // gives 12AB

原文地址:https://blog.csdn.net/wangbinyantai/article/details/79192141

原文地址:https://www.cnblogs.com/yzmy/p/14193492.html