Correct format specifier for double in printf

后端 未结 5 1162
遇见更好的自我
遇见更好的自我 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:18

    %Lf (note the capital L) is the format specifier for long doubles.

    For plain doubles, either %e, %E, %f, %g or %G will do.

提交回复
热议问题