title: Consecutive calls to fgetc in C
body: <p>I am working on implementing a brainfuck interpreter, and I'm struggling with the call of two consecutive <code>,</code> commands.</p>
  
  <p>Here's an extract of my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  #define MEM_SIZE 30000
  #define MAX_LINE_LENGTH 256
  
  int main (int argc, char **argv)
  {
      char *input = ",.,.";
      char bytes [MEM_SIZE] = {0};
  
      int pos=0;
      int i=0;
  
      while (input[i] != '\0'){
  
          switch (input[i]){
              case '.':
                  printf ("%c", bytes[pos]);
                  break;
              case ',':
                  printf ("Enter Number:\n");
                  bytes[pos] = fgetc (stdin);
                  printf ("Number Entered\n");
                  break;
              default:
                  break;
          }
          i++;
      }
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>The output of the program is the following:</p>
  
  <pre><code>Enter Number:
  3                  // This is me, manually entering the value.
  Number Entered
  3Enter Number:
  Number Entered
  </code></pre>
  
  <p>Why isn't the second call to <code>fgetc</code> working?</p>