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.

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:

The exit () function in C Picture 1

According to Tutorialspoint

Previous article: Function atexit () in C

Next lesson: Function getenv () in C

5 ★ | 1 Vote

May be interested

  • MAX function in SQL ServerMAX function in SQL Server
    the article will explore and show you how to use the max function in sql server to find the maximum value in a set.
  • How to log out of your Google account on devicesHow to log out of your Google account on devices
    google is now a popular account, when you can use gmail or other applications such as google drive, google docs, etc. through your google account.
  • SUM function in SQL ServerSUM function in SQL Server
    the sql server sum function returns the total value of a column, a data set, or an expression.
  • The ord () function in PythonThe ord () function in Python
    the built-in ord () function in python returns an integer representing the unicode code of the specified character.
  • RIGHT function in SQL ServerRIGHT function in SQL Server
    the article will explore and guide you how to use the right function in sql server to extract some characters from the right side of a given string.
  • Int () function in PythonInt () function in Python
    the int () function in python returns an integer object from any number or string.
  • AVG function in SQL ServerAVG function in SQL Server
    the avg function in sql server returns the average value of an expression or average value according to the specified column of the selected row.
  • How to exit, logout Viber account on computers, laptopsHow to exit, logout Viber account on computers, laptops
    how to exit, logout viber account on computers, laptops. viber is the popular ott (over the top) app on phones with millions of daily users. viber is one of the leading applications and names like zalo, whatsapp, messenger .. l
  • Hex () function in PythonHex () function in Python
    the hex () function is one of python's built-in functions, used to convert an integer into the corresponding hexadecimal form.
  • ABS function in SQL ServerABS function in SQL Server
    this article will show you in detail how to use the abs () handling function in sql server with specific syntax and examples to better visualize and capture functions.