title: C - fscanf in while loop skips user input
body: <p>So I run the program, it does the prints, reads the char I type from the keyboard,
  switches to the appropriate case, but instead of returning to the top of the loop and stopping at the fscanf in order to receive further input, it acts like it already received a new line or something and switches to the default case, returning to the top of the loop again and expecting input. What am I missing ?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main () {
    char *command;
    command = malloc (2);
  
    while (1) {
      printf ("Type help for usage\n");
      printf ("Enter command: \n");
      fscanf (stdin,"%c",command);
  
      switch (command[0]) {
        case 'a':
          printf ("a\n");
          break;
  
        case 'h':
          printf ("help\n");
          break;
  
        default:
          printf ("default\n");
      }
    }
    return 0;
  }
  </code></pre>