[Solved] Error while compiling the code ‘double free or corruption (out)’ using threads in C? [closed]

The *fp is a global variable, so each therad will initialize it with fopen and after finished working try to close it. the *fp is shared between threads (which should not be) so each thread before exiting tries to close the file handle stored in *fp and the double free occurs when multiple threads tries … Read more