title: getchar() in C is completed without pressing Enter
body: <p>From my <a href="https://stackoverflow.com/q/27297811/3429430">previous post</a>, I come to know that getchar() completes only when we press Enter. Let's consider this code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  main()
  {
    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
  
  
  }
  </code></pre>
  
  <p>I expected it to run like this: I press some key1 then press Enter, then key2 an Enter, then key3 and Enter, then key4 and Enter and at last key5+Enter, the program should terminate now. This is not what actually happens. What happens is this:  I press some key1 then press Enter, then key2 an Enter, then key3 and Enter, the program eventually terminates!</p>
  
  <blockquote>
    <ul>
    <li>Why don't the last two getchar() work?</li>
    </ul>
  </blockquote>
  
  <p>Another weird thing that I observed is that if I do: key1,key2,key3,key4+Enter then the program terminates. E.g. If I press q,w,e and r in succession and then Enter, the program terminates.</p>
  
  <blockquote>
    <ul>
    <li>Why not all the getchar() ask for enter? Does this mean that getchar() take any other key as Enter? But then does the next key is taken as the input for the next getchar()? </li>
    </ul>
  </blockquote>
  
  <p>Let's consider another code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  main()
  {
  
    int c=getchar();
    int d=getchar();
    int e=getchar();
    printf("2 getchar are remaining\n");
    int f=getchar();
    int g=getchar();
    printf(" c is %d, d is %d, e is %d, f is %d and g is %d",c,d,e,f,g);
  
  } 
  </code></pre>
  
  <p>I input: ABCDEFG then Enter. The line <em>2 getchar are remaining</em> should be printed as soon as I press C or D. But it is printed at last, means that all the getchar()s get executed simultaneously-- this is weird.</p>
  
  <blockquote>
    <ul>
    <li>Isn't the program get executed line by line? I.e. after the third getchar, printf() should work. But it works at last when all the getchar()s are executed.</li>
    </ul>
  </blockquote>