|
From: Ricardo R. <ri...@un...> - 2003-04-11 09:38:58
|
scanf ( ) doesnot read the 'return' char,
then it stays in the input buffer until the next reading.
Two options for the next sentence:
(1) If you read in the next sentence with gets( )
the 'return' char is transformed in the
empty char string: " " = '\0' .
(2) If you read a char in the next sentence with scanf( )
the 'return' char it is transformed in the 'line jump'='\n'.
In consequence, if you dont want any strange/side effect in your input
the best option I know after an entry with scanf( ) it's to free the
input buffer:
fflush(stdin).
Any other explanation is wellcome,
but I hope it can help you,
Ricardo.
|