i have a code that prints  the content of a txt file reversely as a string.İ store the every characters of my string in the txt file by using malloc() function.İt works properly but it prints the content of the with a preceding '\0' What is the reason?
void veriyitersyazdir(FILE *file)
{
    char metin;          // that gets the every single char of my string
    int boyutsayac=0;    // that stores my string's size
    char *metinarr=NULL; // that is my malloc() array pointer
    int dongusayac;      // that is a counter variable that is used to print my string reversely.
    system("cls");
    file = fopen("C:\\metin.txt", "r");
    do {
        metin = fgetc(file);
        if (metin==EOF) {
            break;
        }
        boyutsayac++;
    } while (1);
    metinarr = (char *) malloc(sizeof(char)*boyutsayac);
    fseek( file, 0, SEEK_SET);
    for (dongusayac = 0; dongusayac < boyutsayac; dongusayac++) {
        metin = fgetc(file);
        metinarr[dongusayac]= metin;
    }
    fseek( file, 0 , SEEK_SET);
    for (; dongusayac >=0; dongusayac--) {
        printf("%c", metinarr[dongusayac]);
    }
    fclose(file);
}
content of the txt file:Mustafa Mutlu
the output of the codes: UltuM afatsuM
 
     
    