Undoubtedly THE most frequently asked question.
The answer is that scanf() reads up to the first newline char '\n' it encounters in the input stream, or the first char it can't format as it expects.
Way to deal with this is:
You need to use getchar() after every scanf(), to keep the input buffer clear. Note that
//now, pull the newline char (which you get every time you hit enter key)
//off of the keyboard buffer, with:
getchar(); //pulls one char off the standard input stream
//for Turbo C, use
someVariable = getchar(); someVariable++; //can be an int or a char, either one.
//which stops stupid warnings from Turbo C
//Now scanf() is ready to stop ignoring you.
fflush(stdin), is undefined - sometimes it works, sometimes it doesn't. fflush() is designed for use on *output* buffers, not input buffers.