1.

Is It Possible To Execute Code Even After The Program Exits The Main() Function?

Answer»

There is a standard C function NAMED atexit() for this purpose that can be used to perform some operations when your program exiting. You can register some functions with atexit() to be EXECUTED at the time of termination. Here's an example:
#include <stdio.h>
#include <stdlib.h>
VOID _some_FUNC_(void);
INT main(int argc, char** argv)
{
...
atexit(_some_FUNC_);
….
}

There is a standard C function named atexit() for this purpose that can be used to perform some operations when your program exiting. You can register some functions with atexit() to be executed at the time of termination. Here's an example:
#include <stdio.h>
#include <stdlib.h>
void _some_FUNC_(void);
int main(int argc, char** argv)
{
...
atexit(_some_FUNC_);
….
}



Discussion

No Comment Found