Node:Table of Output Conversions, Next:Integer Conversions, Previous:Output Conversion Syntax, Up:Formatted Output
Here is a table summarizing what all the different conversions do:
%d
, %i
%d
and %i
are synonymous for
output, but are different when used with scanf
for input
(see Table of Input Conversions).
%o
%u
%x
, %X
%x
uses
lower-case letters and %X
uses upper-case. See Integer Conversions, for details.
%f
%e
, %E
%e
uses
lower-case letters and %E
uses upper-case. See Floating-Point Conversions, for details.
%g
, %G
%g
uses
lower-case letters and %G
uses upper-case. See Floating-Point Conversions, for details.
%a
, %A
%a
uses
lower-case letters and %A
uses upper-case. See Floating-Point Conversions, for details.
%c
%C
%lc
which is supported for compatibility
with the Unix standard.
%s
%S
%ls
which is supported for compatibility
with the Unix standard.
%p
%n
%m
errno
.
(This is a GNU extension.)
See Other Output Conversions.
%%
%
character. See Other Output Conversions.
If the syntax of a conversion specification is invalid, unpredictable things will happen, so don't do this. If there aren't enough function arguments provided to supply values for all the conversion specifications in the template string, or if the arguments are not of the correct types, the results are unpredictable. If you supply more arguments than conversion specifications, the extra argument values are simply ignored; this is sometimes useful.