You are here : Cstdlib.hexit

exit() - stdlib.h

The C library function void exit(int status) terminates the calling process immediately.

Any open file descriptors belonging to the process are closed and any children of the process are inherited by process 1, init, and the process parent is sent a SIGCHLD signal.

If status is zero or EXIT_SUCCESS, a successful termination status is returned to the host environment.
If status is EXIT_FAILURE, an unsuccessful termination status is returned to the host environment.
Otherwise, the status returned depends on the system and library implementation.


Syntax

void exit(int status)


Example

#include <stdio.h>
#include <stdlib.h>

int main ()
{
   printf("Start of the program....\n");
   
   printf("Exiting the program....\n");
   exit(0);

   printf("End of the program....\n");

   return(0);
}


Output / Return Value


Limitations


Alternatives / See Also


Reference