If you want to call something after main, you may use atexit().