I'm trying to run a simple program that reads a file and returns the context and the number of alphabetical characters. Im getting a wrong output.
#include <stdio.h>
#include <ctype.h>
int main()
{
    FILE *f;
    char path[100],c;
    int sum;
    printf("\nGive file's path: \n");
    scanf("%s",&path);
    f=fopen(path,"r");
    if(f==NULL){
        printf("\nFile not found.\n");
        return -1;}
    while(!feof(f)){
    c=fgetc(f);
    putchar(c);
    if (isalpha(c)!=0){
        sum++;}
    }
    printf("\n\n %d Alphabetical characters found.\n\n",sum);
    fclose(f);
    return 0;
}
File's context is: 12345 abz 12345 ABZ I should get the context and the number 6. instead i get this:
12345 abz 12345 ABZ
�
 4772675 Alphabetical characters found.
 
     
    