Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
return 0 vs. return 1 in main()?
I've been under the impression that main should always return an integer, and further that if the program operated correctly, it should return 0. I see a lot of programs which use return 1 at the end of main(). Isn't this telling the calling program that an error was detected when the called program finished? I realize that if the calling program doesn't check for errors, the 0 vs. 1 would probably be moot, but shouldn't 0 be used, just in case?
Along the same lines, there are a lot of tutorials/info sites that don't have any return in their main() sections, and many without main() declared as an integer. Are compilers just being built that don't care about these items, and if so, should programmers? Thanks.