Código:
Return Value
On success, the function returns the number of items succesfully read. This count can match the expected number of readings or fewer, even zero, if a matching failure happens.
In the case of an input failure before any data could be successfully read, EOF is returned.
http://www.cplusplus.com/reference/clibrary/cstdio/scanf/