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
How to Speed Up Your Content Creation Process While Ensuring Quality
Close-up of the birthing process of the venomous snake with the longest fangs in the world
Difference between ARM and Intel processors
How to use the Round function in Excel to round numbers and process data
Windows 11 24H2 Boosts Performance for AMD Ryzen Processors, But Not Intel
Laptop automatically stops charging when playing games - Fast processing