title: How to count doubles in C?
body: <p>I am working through the C programming language book. So this program is supposed to count each iteration of getchar(). If I type a double (2.3 and 1.8), then CTRL + D, it outputs 8. Why is that? shouldn't nc be 2 since it increments by 1 twice? Thank you.</p>
  
  <pre><code>int main()
  {
      double nc;
  
      for (nc = 0; getchar() != EOF; ++nc) 
              ;
      printf("%.0f\n", nc);
  }
  </code></pre>