-1

Can someone please take a look and advise why the program does not move forward after the scanf gets a char(&), but waits for another char to be entered?

char user_char, hist_axis;
int axis_char_ok = 0,grade, max_count=0,j,k,m=1,grades[9] = {0};

printf(" Please enter a character:  \n");
scanf(" %c ", &user_char);
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
ERN
  • 1
  • 1

1 Answers1

2

The space following %c will eat up as much white space as possible, so it won't stop until you enter something that isn't a space or a line break (or an end-of-file).

If you change " %c " to " %c" then the problem should go away.

r3mainer
  • 23,981
  • 3
  • 51
  • 88