return 0; question

Mar 29, 2012 at 12:25am
I was informed that C++ already did this by default so theres no need to put it.
Is this correct or do i still need to include it in my program. My program works fine without it sooo???
Last edited on Mar 29, 2012 at 12:25am
Mar 29, 2012 at 12:27am
main() implicitly returns 0 when it reaches the end. However, that is not true for any other function.
Mar 29, 2012 at 12:47am
so if i were to make another function i would need to include this?
Mar 29, 2012 at 12:51am
Only if it returns an integral value and you actually want to return 0...
In functions that do not return void, you must exit the function with return (not counting program termination and exceptions).
Topic archived. No new replies allowed.