#include <stdio.h>
int main(void)
{
int ch;
char buf[BUFSIZ];
puts("Flushing input");
while ((ch = getchar()) != '\n' && ch != EOF);
printf ("Enter some text: ");
if (fgets(buf, sizeof(buf), stdin))
{
printf ("You entered: %s", buf);
}
return 0;
}
got few noob question, what does the
what it flushed?and why it need to be flushed?Code:puts("Flushing input"); while ((ch = getchar()) != '\n' && ch != EOF);
if (fgets(buf, sizeof(buf), stdin))<=== the stdin means what?