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.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3296b-4d4c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3296b-4d4c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?