The printf format specifiers have the following form:
% [flags] [width] [.prec] [F|N|h|l|L] type_char
Each format specifier begins with the percent character (%). After the % come the following optional specifiers, in this order:
Optional Format String Components
These are the general aspects of output formatting controlled by the optional characters, specifiers, and modifiers in the format string:
Component
|
Optional/Required
|
|
[flags]
|
(Optional)
|
Flag character(s) Output justification, numeric signs, decimal points, trailing zeros, octal and hex prefixes.
|
[width]
|
(Optional)
|
Width specifier Minimum number of characters to print, padding with blanks or zeros.
|
|
(Optional)
|
Precision specifier Maximum number of characters to print; for integers, minimum number of digits to print.
|
[F|N|h|l|L]
|
(Optional)
|
Input size modifier Override default size of next input argument:H = short int
L = long
L = long double
|
type_char
|
(Required)
|
Conversion-type character.
|
|