Passing Computed Values on to the Outside World
Our example program:
int i, j;
i = 5;
j = 3;
printf("sum = %d, product = %d\n", i + j, i * j);
which illustrates how we incorporate values of expressions or
variables into the output that printf generates.
The string that we printed back in
is really called the
This string defines how the output is to be formatted.
Most of the string in this example is composed of characters that
are to be literally written to the output.
entries are called
and define how the values of expressions or variables are to
The only one we're using here is
that the value is to be displayed as a decimal integer.
The values to be output are found by evaluating the expressions
following the format string.
In this case the expression
i + j
is evaluated and
it's value is printed at the point in the output where the first