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?