unable to read the EOF character in C
问题 I have a problem with reading the EOF character for the last input in C j=0; while(*(name2+j)!='\n'){ if(*(name2+j) == ' '){ j++; continue; } d[tolower(*(name2+j))]++; j++; } For the last input, there is no new line character, the value of j is getting set to very large number for a very small string. So, to consider the end of file, i modified the while condition to while(*(name2+j)!='\n' && (*(name2+j))!=EOF) but still i am having the same problem. Can someone tell if i am missing something