What\'s the difference? Which is preferred, or when should I use each one respectively?
For truly portable code, EXIT_FAILURE
is preferred. The C standard only defines meaning for three values: EXIT_FAILURE
, 0
, and EXIT_SUCCESS
(with 0
and EXIT_SUCCESS
essentially synonymous).
From a practical viewpoint, most typical systems accept other values as well. If memory serves, Linux will let you return any 8-bit value, and Windows 16-bit values. Unless you honestly might care about porting to an IBM mainframe, VMS, etc., chances are you don't care about most of the systems that won't support at least 8-bit return values.