在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'参数。 –