Correct format specifier for double in printf

后端 未结 5 1200
遇见更好的自我
遇见更好的自我 2020-11-22 06:01

What is the correct format specifier for double in printf? Is it %f or is it %lf? I believe it\'s %f, but I am not sure.<

5条回答
  •  我寻月下人不归
    2020-11-22 06:04

    It can be %f, %g or %e depending on how you want the number to be formatted. See here for more details. The l modifier is required in scanf with double, but not in printf.

提交回复
热议问题