+ 1

Can I use Type Specifier of Long Double in C as %lf instead of %Lf?

Programming Language : C

10th Oct 2020, 4:29 AM
Siriki Lohit
2 ответов
+ 2
It appears to depend on the compiler you're targeting. I would use %Lf since it works in all c and c++ compilers that I could find it documented for. Based on documentation https://linux.die.net/man/3/printf it should be capital %Lf. Based on documentation with Visual c++ at https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/tcxf1dw6(v=vs.100) either case is fine. %Lf or %lf are both fine for Visual C++ 2010.
10th Oct 2020, 4:40 AM
Josh Greig
Josh Greig - avatar
+ 1
Thanks
10th Oct 2020, 4:41 AM
Siriki Lohit