C printf #用法?

為什麼printf("%#02X%s", output[i], (i % 16 == 15) ? "
" : (i % 4 == 3) ? " " : " "); 00的時候不列印 0X

如:

TX Interleaver output: [28 bytes]

0XC0 00 00 00 0X84 0XCF 0X33 0X31 0XC 0X47 0XCC 0X32 0X48 0X8B 0XFF 0X2

0XC 0XCF 0X44 0XCD 0X54 0XEF 0X43 0XB1 0X44 0X33 0X44 0XEE


# A `#" character specifying that the value should be
printed in an ``alternate form"". For c, d, and s, for-
mats, this option has no effect. For the o formats the
precision of the number is increased to force the first
character of the output string to a zero. For the x (X)
format, a non-zero result has the string 0x (0X)
prepended to it. For e, E, f, g, and G, formats, the
result will always contain a decimal point, even if no
digits follow the point (normally, a decimal point only
appears in the results of those formats if a digit fol-
lows the decimal point). For g and G formats, trailing
zeros are not removed from the result as they would oth-
erwise be;

For the x (X) format, a non-zero result has the string 0x (0X) prepended to it.


推薦閱讀:

為什麼多數外掛都用易語言?
對心理學專業者來說,哪些編程語言是應該學習和掌握的?
CPU處理無條件轉移指令時,為何實際上要清除流水線?
為什麼Python有那麼多方便的庫而C++很少?

TAG:編程 | C編程語言 | CC |