Make sure the scanf
discards the newline. Change it to:
scanf(" %c", &loop);
^
More Related Contents:
- How do you type something on the same line of text in C [closed]
- Why is “while ( !feof (file) )” always wrong?
- Disadvantages of scanf
- How to use sscanf in loops?
- Why does scanf ask twice for input when there’s a newline at the end of the format string?
- C: Multiple scanf’s, when I enter in a value for one scanf it skips the second scanf [duplicate]
- When should I use ampersand with scanf()
- How to write a while loop with the C preprocessor?
- scanf: “%[^\n]” skips the 2nd input but ” %[^\n]” does not. why?
- What does space in scanf mean? [duplicate]
- Reading a line using scanf() not good?
- Does scanf() take ‘\n’ as input leftover from previous scanf()?
- printf not printing on console
- Going through a text file line by line in C
- difference between %ms and %s scanf
- Reading a single character in C
- How to prevent system hang before watchdog timer task kicks in
- Max string length using scanf -> ANSI C
- Get scanf to quit when it reads a newline?
- C – trying to read a single char from stdin (and failing) w/ scanf / getchar
- Program doesn’t execute gets() after scanf(), even using fflush(stdin)
- scanf(“%c”) call seems to be skipped
- Why is adding a leading space in a scanf format string recommended?
- If statements not working?
- Using scanf and fgets in the same program?
- When implementing an infinite loop, is there a difference in using while(1) vs for(;;) vs goto (in C)?
- What are scanf(“%*s”) and scanf(“%*d”) format identifiers?
- C For loop skips first iteration and bogus number from loop scanf
- scanf not working. need to read double from console
- Scan multiple integers without knowing the actual number of integers