I now want to know that means this line:
printf("Answer: %00010.6f", 22);
He prints: 022.000000. But way? i know whar 6f means float.
thansk for answers
I now want to know that means this line:
printf("Answer: %00010.6f", 22);
He prints: 022.000000. But way? i know whar 6f means float.
thansk for answers
printf("Answer: %f", 22) would enter the number 22 to the string "Answer: %f" in the place of the "%f" and print it as a float ("f" is for "float"). The numbers between the "%" and the "f" are to set the format - the number of digits that the printout will have.
The printf()
syntax and meanings are very well-documented. Look at the printf(3) man page or the Wikipedia printf entry.
The particular example you gave means: print a floating point number. Give it 6 characters after the decimal point. Then prefix it with zeros until it is at least 10 characters.
this format string means:
After initially thinking this was C (result of long habit), I realize this is for PHP. Mostly the same, but the constant seems to be handled differently.
Anyway, the parameters in your code break down as follows:
It seems the printing parameters for PHP's printf are actually on the sprintf page.