Exit () and _ exit () and return

Source: Internet
Author: User

Labels: C ++ C memory Kernel

The difference between exit () and return: According to ansi c, return and exit () are used in the originally called Main () with the same effect. However, note that "initial call" is used here ". If main () is in a recursive program, exit () will still terminate the program; but return will hand over control to the first level of recursion until the first level, at this time, return will terminate the program. Another difference between return and exit () is that it terminates the program even if exit () is called in a function other than main. _ Exit () differs from Exit: header file: Exit: # include <stdlib. h> _ Exit: # include <unistd. h> _ exit () function: directly stop the process, clear its memory space, and destroy various data structures in the kernel. Exit () the functions are encapsulated based on these and several processes are added before execution and exit. The biggest difference between the exit () function and the _ exit () function is that the exit () function checks the file opening before calling the exit system, and writes the content in the File Buffer back to the file.

Exit () and _ exit () and return

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.