+ 3
Quoting Coder Kitten from here:
https://www.sololearn.com/Discuss/2588742/?ref=app
For performance reasons, output is not written to the stream immediately, but to memory. As the buffer fills up, all of it is written at once. That is because invoking the operating system and write operations to devices such as the screen but especially to disk are expensive. Character by character writing is therefore avoided, and characters are collected until there are enough and are then written in just a single write operation.
What fflush does is force the character collection centre to be emptied immediately, regardless of how many characters are in there.



