![]() |
![]() |
![]() |
![]() |
![]() |
|
The read function is named scanf, an acronym for
scan formatted. The read function, scanf, is the
complement of the display function,
printf.
The read function picks up a value for a variable by watching what you type
on your keyboard. In the following statement, for example, the read
function picks up an integer and assigns that integer to an
ampersand-prefixed size_one variable:
*-------*
| |
| v
| ---------
scanf ("%i", &size_one);
For now, you must think of the ampersand prefix, &, as a language
idiom; later, in the hardcopy version of this book, you learn what ampersands do and why
ampersands must appear in front of the variables that are assigned values
by scanf.