Hi! So. I am trying to write a program that counts the number of characters entered into the program from the keyboard until EOF. My teacher is having me use the getchar() function. The problem is my program seems to want to increment the count variable twice every time...
Code:
#include <stdio.h>

int main( int argc, char *argv[] ) {

  int c;
  int count;

  count = 0;

  while ( ( c = getchar() ) != EOF ){

    count ++;

  }

  printf ("\n%d characters were entered.\n\n", count);

  return 0 ;
}
So if I entered 3 4 and 5, it would report 6. Does anyone have any ideas why this is happening? Did I just make a really stupid mistake? Thanks in advance.