I ran a quick test using this code
Code:
#include <stdio.h>

int main(void)
{
	int nc;
	for (nc = 0;getchar()!='\n';nc++)
		;

	printf ("%d\n", nc);

	return 0;
}
It worked just fine and printed an answer. I'm not sure why you were using a double, but an int should work. Also, I replaced the EOF with '\n' so it will stop counting when I hit enter.

- Sean