+ 2

What do we mean by 4.2f in C programming?

I know that f is float which is a data type. But what is 4.2f? Confused!

16th May 2020, 12:06 PM
Abhijnan Saraswat Gogoi
Abhijnan Saraswat Gogoi - avatar
1 RĂ©ponse
+ 8
The format %4.2f means that you specify only to use 2 decimal digits. and 4 is the width (usually right-justified). If you have a number = 3.223, printing with %5.2f. (from a site)
16th May 2020, 12:09 PM
James Clark I. Vinarao
James Clark I. Vinarao - avatar