I was looking at atexit() and saw it takes a function pointer to a function with no return value or parameters. If I wanted to use this to clean up memory I allocated or save any data( like saving highscores to a file for a game ) in some variable, could I do it without the use of global variables?
Note : Assume I would only register the function after I checked everything is in working order.