When you type one character and press enter, it prints two values, so it turns out that it does read "enter" from the input buffer. What does getchar actually return on reading enter? Moreover I can't understand why fflush(stdin) doesn't have any effect on the output when you type a string like("bytes")an d then press enter.
Code:
#include <stdio.h> /* count characters in input; 2nd version */ void main() { int nc; for (nc = 0;getchar()!=EOF;nc++) { //fflush(stdin); printf("%d\n",nc); //printf("%.0f\n", nc); }
Comment