+ 5

Confusing format specifiers

Can anyone explain in detail about %f format specifier in C and all it's variations, because it's confusing to me as I'm new to C. 1. if I write %5.2f ... does 5 matters here? 2. if I add negative sign %-5.2f does it make any change? and some more clarity if someone can give I'd be glad https://code.sololearn.com/c6IwgTBS8Ggt/?ref=app

13th Oct 2018, 5:09 AM
Zoetic_Zeel
Zoetic_Zeel - avatar
3 Respostas
+ 14
5 tells it that the number should take up at least 5 characters. The minus means left alignment. You can find some info on the following web site... https://www.geeksforgeeks.org/format-specifiers-in-c/
13th Oct 2018, 10:21 AM
Modi
Modi - avatar
+ 5
I never experimented with all this! Thanks for asking this question and thanks Modi for answering
17th Oct 2018, 6:29 AM
Abhishek Tandon
Abhishek Tandon - avatar
+ 3
Modi Thank you very much for the clear clarification and resource link..😊🙏
13th Oct 2018, 10:32 AM
Zoetic_Zeel
Zoetic_Zeel - avatar