Search code examples
multithreadingprocesscontrol-flow

Is it possible to execute code even after the program exits the main()


Is there any possibility to execute code even after the program exits the main() method?


Solution

  • In C and C++, functions registered through atexit() can be called after main() returns.

    In C++, static destructors can also be called after main() returns.