Data Type in C++: Signed, Unsigned, Short, and Long (Type Modifiers)
Data Type in C++: Signed, Unsigned, Short, and Long (Type Modifiers)
Data Type in C++: Signed, Unsigned, Short, and Long (Type Modifiers)
printf Commands
printf Format Specifiers
What It Means
Flag
- Left-justifies the result, pads on the right
with blanks.
If not given, right-justifies result, pads on
left with zeros
or blanks.
If you use an "*" for the precision specifier, the next argument in the call (treated as an int)
specifies the precision.
If you use asterisks for the width or the precision, or for both, the width argument must
immediately follow the specifiers, followed by the precision argument, then the argument for the
data to be converted.
No numeric characters will be output for a field (i.e., the field will be
blank) if the following conditions are all met:
you specify an explicit precision of 0
the format specifier for the field is one of the integer formats (d, i, o, u, or x)
the value to be printed is 0
How [.prec] affects conversion
Type
Char Effect of [.prec] (.n) on Conversion
d Specifies that at least n digits are
i printed.
o If input argument has less than n
u digits, output value is left-padded
x with zeros.
X If input argument has more than n
digits, the output value is not
truncated.
e Specifies that n characters are
E printed after the decimal point, and
f the last digit printed is rounded.