Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Return 0 in C
As I understand,
indicates that the program ran properly.
Why would a programmer have
in their code, indicating that it did not run properly? I am not understanding correctly?
Should I always use return 0, or is that incorrect?
In C the main function has to return an integer. A zero has been established as the code for success, but other numbers have been used as exit codes to return a variety of messages.
Here's an example list of Window's exit codes: