Go to the first, previous, next, last section, table of contents.
#include <stdio.h> int printf(const char *format, ...);
Sends formatted output from the arguments (...) to stdout
.
The format string contains regular characters to print, as well as conversion specifiers, which begin with a percent symbol. Each conversion speficier contains the following fields:
-
+
+
sign on positive numbers.
space
#
0
, hexadecimal
numbers with 0x
or 0X
, or force a trailing decimal point
if a floating point conversion would have omitted it.
0
*
), which means that the actual
width will be obtained from the next argument. If the argument is
negative, it supplies a -
flag and a positive width.
g
or G
, actual for others), or the maximum number of
characters for a string.
h
to specify
short
, l
to specify long ints, or L
to specify
long doubles. Long long type can be specified by L
or ll
.
c
d
D
e
E
"Le"
or "LE"
. The exponent case matches the specifier
case. The representation always has an exponent.
f
"Lf"
. The representation never has an exponent.
g
G
"Lg"
or "LG"
. The exponent case matches the specifier
case. The representation has an exponent if it needs one.
i
n
o
p
x
specifier.
s
NULL
-terminated string.
u
U
x
X
%
The number of characters written.
ANSI, POSIX
printf("%-3d %10.2f%% Percent of %s\n", index, per[index], name[index]);
Go to the first, previous, next, last section, table of contents.