Possible Duplicate:
Error handling in C code
What return value should you use for a failed function call in C?
I always use 0, but its not really readable in if, while, etc.
Should I return 1? Why main function return 0 for success?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s defined by the C standard as
0for success (credits go to hvd).But
(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.