How to use printf()

Syntax

printf(ControlString, arg1, ..., argn);

Everything within the ControlString is printed verbatim except %d’s which are replaced by the argument values from the list.

Code example

int n = 1, m = 7;
printf("n = %d\nm = %d\n", n, m);

The output is:

n = 1
m = 7

%d is the conversion character.
\n is a special character.

See next section for a list of conversion characters.