No, it means that the while loop will process ANY key that you press up until you press the enter key, which will then exit the loop. The '\n' character will not enter the loop, so you don't need to worry about it at all.
Originally Posted by petedee
/*** EDIT ***/
*Grumbles* I should be more careful when I'm reading codes...
the precise line that you gave me,
has the effect of clearing out the input stream.
while ((let2bg = getchar()) != '\n'); <-- didn't see this semicolon just now...
that is to say in this example
if you comment out the line "while((temp= getchar()) != '\n');", the program will enter an infinite loop after you enter "12abc" because of the stuff that scanf is leaving in the input stream.
int main (void)
int data = 0;
while(data != 13)
printf("Please enter 12abc here: "); //gets user to type 12abc and press enter
printf("enter 13 instead of 12abc to exit program.\n");
while((temp= getchar()) != '\n'); // comment and uncomment this line to see what happens