what does fflush do??
what fflush(stdin)means??
It flushes the input buffer i.e. writes everything to the output stream.
Some systems don't write all the input buffer contents to the screen until newline character is encountered so to write everything to the screen fflush() can be used.
what fflush(stdin)means??
It means whatever the implementation chooses it to mean. The C standard says that calling fflush() with an input stream is undefined. However, many implementations choose to make it read and discard unread input from the stream in a manner similar to this explicit loop:
while (getchar() != '\n')
;
You cannot rely on that behavior, but it can be useful if all targeted implementations support it.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.