If the file is empty or does not start with a number, then fscanf() would return empty, and empty cannot be stored in a particular location.
Note: It is unlikely that you want to keep reading from the same location in the file. You probably do not want the fopen / fclose to be inside the loops.

