Ask your own question, for FREE!
Computer Science 10 Online
OpenStudy (anonymous):

what is the use of fflush(stdin)in c language

OpenStudy (anonymous):

I believe it flushes the input stream (meaning, clears it out). It is implemented as sometimes invisible characters (new lines/line breaks) get stuck in there. There are other ways to handle these characters without flushes.

OpenStudy (anonymous):

fflush(stdout) is very useful for making sure that all buffered output has been flushed out (usually to a disk file or the terminal). If you don't use it, then Odd Things can happen (for instance, a prompt appearing *after* you do the corresponding read from the terminal, or the last bit of output from the program never actually making it into a disk file). Since fflush() is only defined for "output" streams, it's a good way to generate an EBADF (bad file descriptor) for calling it on a non-output stream.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!