Answer
- The first argument to scanf appears to be a ``control string''
like the ones used by printf. This is actually true. The first argument
for scanf is a control string that tells scanf what kind of data it
should read.
- The control string uses the special ``%d'' sequence. ``
%d'' tells scanf to input an integer, while it tells
printf to output an integer.
- The variable that will be input by scanf is listed in the
scanf statement, just as the variables to be output by printf are listed
in the printf statement.
Return to lesson.
Eric N. Eide
Hamlet Project
Department of Computer Science
University of Utah