Return values of some functions in c
scanf
**scanf("%d” , & i); //10 is given as input
**
Scanf returns number of items successfully read and not 1/0. Here 10 is given as input which should have been scanned successfully. So number of items read is 1.
printf
Upon a successful return, the printf() function returns the number of characters printed (not including the trailing ‘\0’ used to end output to strings). If the output was truncated due to this limit then the return value is the number of characters (not including the trailing ‘\0’) which would have been written to the final string if enough space had been available.
[Read More]