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
5 ★ | 1 Vote
You should read it
Maybe you are interested
Windows 11 24H2 Boosts Performance for AMD Ryzen Processors, But Not Intel
Laptop automatically stops charging when playing games - Fast processing
There is a serious security vulnerability that has existed for 18 years in AMD processors, but it is not too worrying
The process of transmitting solar electricity from space to Earth
Premiere Pro now has a version that supports ARM processors on Windows, what should you keep in mind?
How to speed up text processing on Word