Next: Format Field Width, Previous: Format Specifiers, Up: Formatted Input/Output [Contents][Index]
Format modifiers may be specified in any order.
-
specifies left adjustment of the argument in its field. Right
adjustment is the default. (Does not affect the %t
and %T
formats.)
+
specifies that the number will always be printed with a sign. By default, a sign is not printed for positive numbers.
0
specifies that for numerical arguments the field will be padded with leading zeros if necessary.
(whitespace)
specifies that nonnegative numbers be preceded by a space.
#
specifies an alternate output form. For the o
format, prefixes a
zero for nonzero numbers; for x
or X
, prefixes 0x
or
0X
to nonzero numbers; for e
, E
, f
, g
,
G
, and z
, the number will always contain a decimal point;
for g
, G
, and z
, trailing zeros will not be removed.
*
indicates suppression of assignment when reading input: If a *
is
specified in an input format specification, then a value corresponding
to the format entry with the *
in it is read, but the value is
then discarded. This allows specification of required but not used
fields in the input.
_
indicates that if the argument to which this format entry is applied is an array, then the plain text immediately following the format entry should be printed after each element of the array, rather than just once after all the elements have been printed.
=
indicates that if the argument to which this format entry is applied is an array, then the plain text immediately following the format entry should be printed between all elements of the array, rather than just once after all the elements have been printed.
The _
and =
format modifiers are LUX extensions to the C set.
Next: Format Field Width, Previous: Format Specifiers, Up: Formatted Input/Output [Contents][Index]