Synopsis
#include <stdio.h>
int scanf(const char *format, ...);
Description

scanf reads input from the standard input stream under control of the string pointed to by format that specifies the admissible input sequences and how they are to be converted for assignment, using subsequent arguments as pointers to the objects to receive the converted input.

If there are insufficient arguments for the format, the behavior is undefined. If the format is exhausted while arguments remain, the excess arguments are evaluated but are otherwise ignored.

scanf returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, scanf returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure.

Portability

scanf conforms to ISO/IEC 9899:1990 (C90) and ISO/IEC 9899:1999 (C99).

See Also

Format strings for scanf functions