By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,725 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

what is the difference between exit(1) & exit (-1) ?

P: n/a
what is the difference between exit(1) & exit (-1) ?
Oct 11 '10 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
The exit() library function has only two possible returns: success (typically 0) and failure (typically 1).

Any other return values are non-standard and depend upon a particular implementation of the OS.

Avoid all hard-ced values in your code. You should be using :

Expand|Select|Wrap|Line Numbers
  1. exit(EXIT_SUCCESS);
or

Expand|Select|Wrap|Line Numbers
  1. exit(EXIT_FAILURE);
Oct 11 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.