I am working on counting the no. of words from a input file.
i think the code is alright, however when i click on run,,,
it shows the below photo,,,
what should i do?
my code:
Code:#include <stdio.h> main() { int i, cnt=0; char ch; FILE *fp; fp=fopen("InFile.txt","r"); ch=fgetc(fp); while (ch!=EOF){ if(ch==' ') cnt++; } printf("No of words = %d\n", ++cnt); fclose(fp); }