In main function executing return 0; statement or calling exit(0) function will call the registered atexit handlers and will cause program termination. exit 0 is a syntax error in C. You can have exit(0) that is instead a call to a standard library function. The return statement simply return from the current function.