In a program if we call exit(0), it exits the program and before that it closes all opened stream.
In C++, it even does destroys the created objects. Is there any function available, which if called will do some basic clean ups (which includes object destruction) ???
atexit() does take arguments as it calls a function when exiting the program, however the called function cannot return arguments. Have a look at this page.
If you want your program to return a value, you could try the _exit() function. More info here.