Returning int(0) as a failure is often done in C if the return value is a boolean since C lacks a true boolean type.
[1] NULL should never be used in actual code because it is ambiguous.
Nonzero: error code, zero: success
Nonzero: one of many possible success values, zero: error (e.g. malloc())
Negative: error code, positive: one of many possible success values
And each has its tradeoffs.
Returning int(0) as a failure is often done in C if the return value is a boolean since C lacks a true boolean type.
[1] NULL should never be used in actual code because it is ambiguous.