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.. :D
Printable View
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.. :D
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! :D
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.Quote:
Originally Posted by WaltP
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.