Writes formatted output to the standard output stream
#include <stdio.h> int
printf( const char * restrict
format, ... );
converts various kinds of data into string representations for
output, and substitutes them for placeholders in the string
referenced by the mandatory pointer argument,
format. The resulting output string is
then written to the standard output stream. The return value of
printf() is the number of
characters printed, or
indicate that an error occurred.
The placeholders in the string argument are called conversion specifications, because they also specify how each replacement data item is to be converted, according to a protocol described shortly.
The optional arguments, represented by the ellipsis in the function prototype, are the data items to be converted for insertion in the output string. The arguments are in the same order as the conversion specifications in the format string.
For a general overview of data output with
printf(), see "Formatted Output" in Chapter 13. This section describes
the syntax of conversion specifications in the
printf() format string in detail. The
conversion specifications have the following syntax:
flags consist of one or more of
' ' (space),
#. Their meanings are as follows:
Add a plus sign before positive numbers.
Add a space before positive numbers (not applicable ...