|d||int||decimal (base ten) number|
|o||int||octal number (no leading ‘0’ supplied in printf)|
|x or X||int||hexadecimal number (no leading ‘0x’ supplied in printf; accepted if present in scanf) (for printf, ‘X’ makes it use upper case for the digits ABCDEF)|
|ld||long||decimal number (‘l’ can also be applied to any of the above to change the type from ‘int’ to ‘long’)|
|lu||unsigned long||decimal number|
|c||char [footnote]||single character|
|f||float [footnote]||number with six digits of precision|
|g||float [footnote]||number with up to six digits of precision|
|e||float [footnote]||number with up to six digits of precision, scientific notation|
|lf||double [footnote]||number with six digits of precision|
|lg||double [footnote]||number with up to six digits of precision|
|le||double [footnote]||number with up to six digits of precision, scientific notation|
Footnote: In printf(), the rvalue type promotions are expected. Thus %c
actually corresponds to a parameter of type int and %f and %g actually
correspond to parameters of type double. Thus in printf() there is no
difference between %f and %lf, or between %g and %lg.
However, in scanf() what is passed is a pointer to the variable so no
rvalue type promotions occur or are expected.
Thus %f and %lf are quite different in scanf, but the same in printf.