What is the difference between exit(0) and exit(1) in C language?

王林
Release: 2020-07-18 09:35:29
Original
15230 people have browsed it

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.

What is the difference between exit(0) and exit(1) in C language?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template