I have this problem with my code. Im was copying some numbers from a file i had opened into an array using a for loop. And at the same time, i put a printf statement after the fscanf statement to see whether the value i wanted actually entered the arr. This works fine except that it puts an extra number at the end of the array when it's done. i don't understand why this happens. At first, i thought that I was using a wrong count of the number of elements in the file or that i had messed up while using malloc but those are completely fine. Can anyone pls tell what wrong. I can't share the code until a specific date cause i am a student and it would be considered cheating.
EDIT: Below is a link to a segment of what is happening in the code. THE LANGUAGE IS C. The code is meant to read the numbers 1 7 5 6 8 3 9 4 2 10 from a file a made but instead it always reads 1 7 5 6 8 3 9 4 2 10 1
EDIT: In the function declaration i meant char* file_name not int char*filename.