What are the differences between exit (0), exit (1), and exit (-1?

Source: Internet
Author: User
What are the differences between exit (0), exit (1), and exit (-1? When the process ends, the return value to the system is different. If your process is user, run echo $? You can see that the return value of your process is the value you set in the program, such as exit (0). Return 0 exit (0) to indicate that the program is normal, exit (1) /exit (-1) indicates that the program exits abnormally, so 1 is still a habit of-1 people, but under normal circumstances, exit_success should be used to indicate normal, exit_failure indicates failure, defined in stdio. h. 0 is normal 1,-1 is abnormal. This is a habit. Of course, you can set the meaning of the returned value based on your preferences. However, it is best to be consistent with these values, in order to avoid code confusion, the upstairs statements are quite right, indicating the status code returned to the system. You can also exit (2), exit (3). Generally, exit (0) is used) indicating normal exit of http://tscsh.blog.163.com/blog/static/200320103201352734932818/

 

What are the differences between exit (0), exit (1), and exit (-1?

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.