title: counting characters in the input with while loop
body: <p>I wrote a simple c program to count number of characters</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  main()
  {
      long nc;
      nc = 0;
  
      while (getchar() != EOF)
        ++nc;
  
      printf("%ld\n", nc);
  }
  </code></pre>
  
  <p>This program is not printing me the characters. On testing different cases, I found that I am stuck in an infinite <code>while()</code> loop.</p>