exit() function in C language by R4R Team

- exit() is a function that are able to terminate the running program.
-It is predefined in process.h header file

Syntax-
exit(value);
-Here value is 0,1,2,3,4,...

Use of exit() function:
-In programming, if you want to terminate your program at certain point then you use this function.


program-

#include< stdio.h>
#include< process.h>
int main()
{
printf("Inside main\n");
exit(0);
printf("After exit function")
}


output-

Inside main

-In this program, only "Inside main" is display because when execution goes on exit() function then program is exit or close or terminate so that next line will not execute.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!