2. Basic I/O functions - Standard input: scanf
•The scanf function reads data from the standard input according to
the format provided
−The format specifiers used with printf are also used with scanf to specify
different types (integers, strings, characters, etc.) to be read
−The prototype of scanf is:
Systems Architecture - 3. Input/Output in C 8
int scanf(const char *format, ...);
On success, the function returns the number of
items of the argument list successfully read. If a
reading error happens, then EOF is returned. EOF
stands for “End of File” an it is a keyword in C
reserved to determine the end of a file
The varargs parameters in scanf need to be
pointers, because the changes made inside the
function scanf are reflected in caller parameters