Could any1 here tell me when exactly fflush is used?
I do understand that fflush is used to clear a stream ...like fflush(stdin) clears the buffer so functions like scanf / getchar can get the right input ?
If I say printf("\n");
and then scanf("%c",&character)
then I should put fflush(stdin) to get the right input..... but do I have to uses fflush EACH TIME I use scanf ?? In that case, why did not the guy who designed C (Mr. Denis Ritchie was it ? ) make fflush a part of scanf ??
In case you find the above confusing,I rephrase it once again....
When EXACTLY do we have to use fflush ? Is it that we have to precede each scanf by an fflush(stdin) statement?