Home > Article > Backend Development > What is the difference between exit(0) and exit(1) in C language?
The difference between exit(0) and exit(1) in C language is: exit(0) means running the program normally and exiting the program; exit(1) means running the program abnormally and causing the program to exit. Exit is a function, which is at the system call level, indicating the end of a process and is provided by the operating system.
The differences are as follows:
exit(0): Run the program normally and exit the program;
exit(1): Abnormal operation causes the program to exit;
(Recommended tutorial: C Language Tutorial)
Explanation:
exit is a function, it is a system call level, indicating the end of a process.
exit is provided by the operating system (or given in the function library) and is used to exit the application, delete the memory space used by the process, and return a status of the application to the OS (operating system).
This status identifies some running information of the application. This information is related to the machine and operating system. Generally, 0 means a normal exit, and non-0 means an abnormal exit.
The above is the detailed content of What is the difference between exit(0) and exit(1) in C language?. For more information, please follow other related articles on the PHP Chinese website!