prev up next   top/contents search

comp.lang.c FAQ list · Question 12.18b

Q: I'm using scanf %c to read a Y/N response, but later input gets skipped.

A: You wanted scanf %c to read a single character, and it tried to, but when you tried to type that single character at it, before the rest of the input system would accept it, you had to hit the RETURN key, too. scanf read only the one character, but that extra newline was still sitting in an input buffer somewhere, and it's that extra newline (seemingly representing a phantom blank line) which was received by your later input call. See also questions 12.18a and 12.20.

prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North