What is the difference between %.02f and %.2f? From what I understand, whatever number comes after the point, indicates the number of decimal places to be displayed when converting a number to a string. But what does it mean when there are two numbers coming after the point as in %.02?
The number after the .
is the number of fractional digits to show. 02
and 2
are the same number - 2
. The 0
has no special meaning here.
There is no significance to a two digit number over a one digit number after the .
. It's just a count. If you had %.10f
you would get 10 fractional digits.
None of this is specific to Objective-C. It holds for any language that follows the IEEE printf specification.