Whenever you input a character
or string
from stdin
in C, always make sure there is no \n
in the input buffer. To do this, always getchar()
after taking integer
or float
inputs.
In your case, maybe you've inputted an integer
before inputting the character
. So try to write a getchar()
before taking the character
input.