Your problem is here:
Do not put the semicolon after the "while()" - if you do so, it constitutes the statement you want to perform, which does nothing. I.e. what you have written is actually:Code:while ( (c=getchar()) !=EOF);
Code:while ( (c=getchar()) !=EOF) /* do nothing */; /* c is now EOF */