What does an 'F' in the Format specifier of printf mean?

爷,独闯天下 提交于 2020-01-06 02:59:33

问题


What does %.8Ff format specifier in printf do?
What does F mean?


回答1:


According to the manual:

The F conversion specifier produces "INF", "INFINITY", or "NAN" instead of "inf", "infinity", or "nan", respectively.

In your format string %.8Ff, the f is treated as a literal character and printed as an f.




回答2:


One possible use of putting a literal f after the format specifier could be to print a string that's later to be parsed by a C or C++ compiler as a float constant instead of double constant.



来源:https://stackoverflow.com/questions/4011940/what-does-an-f-in-the-format-specifier-of-printf-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!