Character Count in C
<p>The folllowing C Program is  to calculate the character Count .</p>

<pre><code>#include &lt;stdio.h &gt;
int main()
{
   int nc = 0;
   while (getchar() != EOF)
   {
      ++nc;
      printf("%d\n", nc); 
   }
    return 0;
}
</code></pre>

<p>When I Enter a character , for example 'y'  in the terminal , The output returns as follows</p>

<pre><code>1
2
</code></pre>

<p>How does this calculation happens and why 2 is in the output?</p>