section 7.2: Formatted Output -- Printf
To summarize the important points of this section:
- printf's output goes to the standard output,
just like putchar.
- Everything in printf's format string
a plain character to be printed as-is,
or a %-specifier which
argument to be consumed, formatted, and printed.
a single %-specifier consumes
two or three arguments if the width or precision is *,
or zero arguments if the specifier is %%.)
- There's a fairly long list of conversion specifiers;
see the table on page 154.
- Always be careful that the conversions you request
(in the format string)
match the arguments you supply.
- You can ``print'' to a string
(instead of the standard output)
(This is the usual way of converting numbers to strings in C;
the itoa function we were playing with
in section 3.6 on page 64
is nonstandard, and unnecessary.)
This page by Steve Summit
// Copyright 1995, 1996
// mail feedback