Can anyone explain to me the use of exit() ? What is the difference of exit(1) and exit(0)? I would be really grateful if someone could explain me about it..
Can anyone explain to me the use of exit() ? What is the difference of exit(1) and exit(0)? I would be really grateful if someone could explain me about it..
1 means something and 0 means something too....in main you return 0 to say that everything is ok,you return -1 to say not ok...so something like that comes to mind...google it and sure you find an answer.If not post back
EDIT->Actually the indian geek just did it :-p
Thank you!
The C standard only mandates that 0 and EXIT_SUCCESS from <stdlib.h> denote successful termination and that EXIT_FAILURE denotes unsuccessful termination. The values of EXIT_SUCCESS and EXIT_FAILURE are unspecified, though it is clear that EXIT_FAILURE must be non-zero.Originally Posted by WaltP
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
The C standard does not stipulate that only EXIT_SUCCESS and EXIT_FAILURE must be passed to exit(). It only specifies what those two values mean. Other values may be returned but the standard specifies no meaning for them. That is why some programs are able to return values that can be used (say) by a shell script or similar.