0

why we need to pass an argument in an exit command?

exit(1);

15th May 2017, 12:05 PM
Ravi prakash
Ravi prakash - avatar
4 odpowiedzi
0
whenever we quit an application it returns a value . 0 means program runs ok any other no means program has error. so exit command has a parameter as integer
15th May 2017, 12:07 PM
MR Programmer
MR Programmer - avatar
0
sorry sir I could not understand . Can u explain again
15th May 2017, 12:09 PM
Ravi prakash
Ravi prakash - avatar
0
when any program exited it returns a value. this value is called exit status. https://en.m.wikipedia.org/wiki/Exit_status if it returns 0 it means the program works properly without any error. exit method exit you application with returning the parameter on it. ex exit(0); means the exit status is 0. if exit (1); means the exit status is 1
15th May 2017, 12:17 PM
MR Programmer
MR Programmer - avatar
0
The exit argument will give you the indication of the exit state eg: -1 = ERROR 1 = OK
15th May 2017, 12:58 PM
nouseforname
nouseforname - avatar