Characters in format that are not the percent sign (`%') are printed verbatim. When a percent sign is encountered, the next argument of the arguments following format is retrieved and printed. The type of the argument expected, as well as some simple formatting instructions, are derived from the characters following the percent sign.
The following characters designate types to print. One of these characters concludes the format sequence begun with a percent sign, and also determines the type expected as an argument.
The following characters are modifiers; they can be found between the percent sign and the type designator.
% A percent sign is printed; no argument is consumed. c Character (char, passed as int) d Signed integer printed in decimal o Unsigned integer printed in octal p Pointer (void *) s String (const char *) u Unsigned integer printed in decimal x Unsigned integer printed in hexadecimal X Unsigned integer printed in uppercase hex
# Select an "alternate format". On integer formats this causes the C base prefix to be printed along with the integer. On other formats, this has no effect. l Assume an integer argument is long or unsigned long instead of int or unsigned int. 0-9 Digits are treated as a decimal number, which is considered to be the field width. The argument is printed right-aligned in a field that many characters wide. 0 If the field width has a leading 0, the padding character for alignment is made 0 (zero) instead of space. - If a field width is given, use it for left alignment instead of right alignment.