Should I return 0 or 1 for successful function? [duplicate]

It’s defined by the C standard as 0 for success (credits go to hvd).

But

For greater portability, you can use the macros EXIT_SUCCESS and
EXIT_FAILURE for the conventional status value for success and
failure, respectively. They are declared in the file stdlib.h.

(I’m talking about the value returned to the OS from main, exit or similar calls)

As for your function, return what you wish and makes code more readable, as long as you keep it that way along your programs.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)