在C你有printf
的"%c"
和"%f"
格式的標誌 - 和scanf
樣的功能。這兩個功能使用可變長度參數...
,它總是轉換floats
到doubles
和chars
到ints
。爲什麼` 「%C」'存在'printf`如果`char`轉換爲`int`?
我的問題是,如果發生這種轉換,爲什麼單獨的標誌爲char
和float
存在?爲什麼不使用相同的標誌爲int
和double
?
相關問題:
Why does scanf() need "%lf" for doubles, when printf() is okay with just "%f"?
哦..明顯。但是,「浮動」呢? –
@PaulManta:'%f'格式標誌需要'double'參數。 –