Why do you need to add such a short function before using gets to read in C language?

our teacher seems to have said something, but I don"t understand it at all.

while((ch=getchar())!=EOF&&ch!="\n")
    ;
CPP c
Apr.07,2021

judge whether enter


get the extra characters on the terminal first, and then wait for the user to enter.

Menu