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
.
![](invis_anchor.xbm)
![](_17661_table1395.gif)
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:
![](_17661_tabbing1407.xbm)
The output on the screen is:
![](_17661_tabbing1411.xbm)
and:
![](_17661_tabbing1415.xbm)
...outputs:
![](_17661_tabbing1419.xbm)