Your lecturer is obviously not particularly concerned with writing code that is robust and safe.
Originally Posted by Salnitro
This will do 42 steps through the loop, no matter how much data is in the file, since you don't check if fread() actually did read something or not. If it fails to read, it won't update the content of slot, so it will repeat the same thing over and over. ]
fprintf( write_file, "%-8s%-9s%-15d%10d%8c\n", slot.name, slot.id, slot.mark1,slot.mark2, slot.grade);
Checking the return value from functions is another thing that should be done to make sure the code is correct [and of course, coupled with appropriate action when error conditions are detected - just checking it and not doing something about it is pretty pointless].