{{keywords>wiki library source code example reference}} ====== exit ====== #include void exit(int status); exit causes the termination of a program.\\ To the environment in which the program was started, a return code will be sent.\\ ===== exit C Sourcecode Example ===== /* * exit c example code * http://code-reference.com/c/stdlib.h/exit */ #include /* including standard library */ //#include /* uncomment this for Windows */ #include int exittest ( int testval ) { if (testval == 3 ) { exit (1); } return 0; } int main( void ) { int i; /* comment this in to see what happen */ // exit(0); for (i=0;i<=99;i++) { exittest(i); printf("%i\n", i); } return 0; } ==== Output with commented exit(0) before the for loop ==== user@host:~$ ./exit 0 1 2 ==== Output with out commented exit(0) before the for loop ==== user@host:~$ ./exit