The exit() statement
The break statement just terminates the execution of a loop or a switch-case construct in which it occurs. The exit() function terminates the execution of the program itself. The exit() is a standard library function and stdlib.h is the header file of exit(). The process.h can also be used instead stdlib.h.
Example:
main()
{
int i;
for(i = 1; i < = 100; i ++)
{
printf("%d\t", i);
if(i = = 3)
exit(1);
}
printf("Out of loop");
}
The exit() requires an integer argument. As the if condition is satisfied exit() would terminate the execution of the program without executing the rest of the statements in the program.