title: Why is getchar() not working for me?
body: <p>I've just started programming c and I'm working through The C Programming Language by Brian W.Kernighan and Dennis M.Richie.</p>
  
  <p>One of the first examples is character counting and the following program is given, but when I enter a string no result it printed.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  main()
  {
     long nc;
  
     nc = 0;
     while (getchar() != EOF)
            ++nc; 
     printf("%ld\n",nc);
   }
  </code></pre>
  
  <p>Why isn't this working?</p>