C library functions - exit ()
C standard library - <stdlib.h>
description
C library functionvoid exit (int status) immediately terminate the calling process.Any part of the process of open file descriptors will be closed, the child process inherited by process 1, initialization, and sends a SIGCHLD signal to the parent process.
statement
Here is the exit () function's declaration.
void exit(int status)
parameter
- status - status value returned to the parent process.
return value
This function does not return a value.
Examples
The following example demonstrates the exit () function is used.
#include <stdio.h> #include <stdlib.h> int main () { printf("程序的开头....\n"); printf("退出程序....\n"); exit(0); printf("程序的结尾....\n"); return(0); }
Let's compile and run the above program, which will result in the following:
程序的开头.... 退出程序....