Hello everybody, I am having a problema with a simple program that is supposed to find the number of characters in a file but apparently it gives me n+1 elements instead of just n. Here is the code, hope you can help me.
Code:#include <stdio.h> int main (void) { FILE *fp; char c; int d=0; fp=fopen("ex4.txt","r"); while(c!=EOF) { c=fgetc(fp); d=d+1; } fclose(fp); printf("The number of characters is %d\n",d); return 0; }