I have a file pointer and I want to remove the file after loading the content of the file in a data structure. I'm not sure whether the file should be closed before removing. Which part of the code is correct?
FILE* myFile = fopen("abc.bin", "rb");
/* Code to load contents of file and do some operations */
fclose(myFile);
remove("abc.bin");
OR
FILE* myFile = fopen("abc.bin", "rb");
/* Code to load contents of file and do some operations */
remove("abc.bin")
fclose(myFile);
Or is it fine to use either of them?