Hopefully a quick one.
I have recently been doing some C Programming again after not doing any for 4-5years.
So, I have gone a bit all out to make a program that does a little bit of everything to refresh my memory.
The function I have issues with is one that closes an open file. It causes everything to crash out.
Function wise I have, menu, openfile, closefile, confirmfile.
I have made it so if I run the program with the argument stuff.txt (as an example) it passes stuff.txt into confirmfile.
This function fopen's the file and points FILE *fp at the file.
FILE *fp is declared at the top and so should be global.
I then use the closefile function to fclose fp.
When I leave the confirmfile function will C automatically close that file, even if I dont declare it?
The error is a double free or corruption error.