The exit () function in C
The void exit (int status) function immediately terminates the calling process. Any file opened by the process is closed and any child process is inherited by the initial process and the parent process is sent a SIGCHILD signal.
The void exit (int status) function immediately terminates the calling process. Any file opened by the process is closed and any child process is inherited by the initial process and the parent process is sent a SIGCHILD signal.
Declare the exit () function in C
Below is the declaration for exit () in C:
void exit ( int status )
Parameters
status : This is the status value returned to the parent process.
Returns the value
This function does not return any values.
For example
The following C program illustrates the usage of exit () in C:
#include #include int main () { printf ( "Bat dau thuc thi chuong trinh .n" ); printf ( "Thoat chuong trinh .n" ); exit ( 0 ); printf ( "Ket thuc chuong trinh .n" ); return ( 0 ); } Compiling and running the above C program will result:
According to Tutorialspoint
Previous article: Function atexit () in C
Next lesson: Function getenv () in C
Discover more
parameters in C value of C pointer in C elements in CShare by
Isabella Humphrey
Update 25 May 2019
You should read it
- The function atexit () in C
- System () function in C
- The abort () function in C
- Call the function by pointer in C ++
- Exit command in Windows
- The Quiet Details That Make a Sports Betting Platform Feel Reliable
- Instructions on creating toy set images with ChatGPT AI
- How are AI agents changing the journalism industry?
- Remove () function in C
- Rename () function in C
- The rewind () function in C