Is it like php, where it returns its argument as the value of the function call? Is it just good practise?
Yes, PHP and many other languages borrowed the
return keyword from ‘C’. And in all the languages, the
return keyword has the same function – to return from the function. Anything that follows
return keyword is the value that is returned to the caller.
Is it a good practise? Yes and No. Not all functions should return a value. And quite a few in the standard library even, do not return any value. Hence their return type is
main function should return
EXIT_SUCCESS) to identify that the program has executed successfully. And -1 otherwise (also
EDIT: (Thanks to @KeithThompson):
EXIT_FAILURE is implementation defined.
1 is a common value of
EXIT_FAILURE but the whole point is, you need not know.