Next: scanf
Up: Formatted I/O
Previous: Formatted I/O
The function is defined as follows:
int printf(char *format, arg list ...) - prints to stdout
the list of arguments according specified format string. Returns number of
characters printed.
The format string has 2 types of object:
- ordinary characters - these are copied to output.
- conversion specifications - denoted by %and listed in
Table
.


Between %and format char we can put:
- - (minus sign)
- - left justify.
- integer number
- - field width.
- m.d
- - m = field width, d = precision of number of digits after
decimal point or number of chars from a string.
So:

The output on the screen is:

and:

...outputs:
