Next: Conversion specification Up: Input-Output Previous: Escape characters for

Simple formatted input

We have briefly met the routine for formatted input, called scanf.

Example

	count= scanf("%d %d", &first_number, &second_number);

Notes

1. There is a conversion specifier string (as for printf).

2. There is a list of arguments.

3. You need & because the arguments will be updated: i.e. each argument is a pointer to the variable where the value read is to be stored.

4. scanf itself returns an integer count of the number of items it has successfully converted.




Next: Conversion specification Up: Input-Output Previous: Escape characters for


maspjw@
Tue Sep 27 15:29:34 BST 1994