Next: scanf Up: Formatted I/O Previous: Formatted I/O

Printf

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:

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:


Dave.Marshall@cm.cf.ac.uk
Wed Sep 14 10:06:31 BST 1994