I am aware that putting any number of 0
\'s before the width of the placeholder implements zero-padding. For example, printf(\"%02d\", 6);
prints
Blockquote
Basically when we % w.p f
for output w
refers to the minimum number of position to be use for displaying the value and p
refers to the number of digit after decimal point.
%3.2f
floating point having 3 wide and 2 number after decimal
%0.2f
floating point at least 0 wide and 2 number after decimal
%.2f
floating point at least 0(default) wide and a precision of 2)
But don't misunderstand about the 0 width if you use %0.2f
it can auto adjust its minimum width.