the same as tiltle. is that exit() just end the function and abort() end the program?

Recommended Answers gives good descriptions of what each function does. exit "cleans up" upon exiting. abort doesn't. Good discussion here.

Jump to Post

All 4 Replies

No.Both abort() and exit() terminate the program and not the function only. Abort() ends the program with "abnormal program termination".It indicates unsuccessful termination of program.

abort() causes a SIGABRT signal, which will then be caught by the appropriate signal handler (which by default usually causes the programme to terminate with an unsuccessful termination code returned to the environment).

exit() terminates the process a bit more carefully. Any functions you registered with the atexit() function get called, streams are closed, temporary files deleted, that sort of thing, and finally a value specified in the function call to exit is returned to the environment.

thanks for everybody

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.