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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zakarya

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

    what is the difference between exit(1) & exit (-1) ?
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    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 :

    Code:
    exit(EXIT_SUCCESS);
    or

    Code:
    exit(EXIT_FAILURE);

    Comment

    Working...