I have looked up what getchar() does, which says it takes a single character input from the keyboard and returns the int value of it. It also does not read white spaces.

With that in mind, I still don't understand why the following statement flushes the input buffer of any white spaces?

while ( getchar() != '\n' && getchar()!=EOF);

More specifically,
1) If getchar() cannot read white spaces, how does it get rid of the newline in the input buffer?

2) Why does the condition use != ?

3) The fact that the rests of the code carries on after this statement, implies that the condition of the statement somehow always becomes true? I get that it becomes false if one presses the EOF, but does it also becomes false if one presses Enter on the keyboard since that amounts to \n?