You're not showing the entire function so there is no context!
wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99
It's on main().
0 means successful.
else error!
wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99
the main() program can often be called by a parent program. 'return 0;' indicates to the caller (parent) that the main() program executed correctly.
so... generally speaking, the main function must be of type 'int' and therefore must return some integer value on completion. zero (0) is the standard "successful" return value (think: returned with zero errors) although it could be some other value that indicates an error state, depending on the caller
if main does not return a value (like the case of 'void main()' ) then you are now in the realm of "undefined behavior" when the program is called by another. Undefined behavior is almost always a Bad Thing.
.
jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
no1zson> What is wrong with GOTO?
It usually is misused and it has the potential of making any code hard to debug and maintain.
no1zson> What would you suggest in its place?
Ideally, a sharp mind with the ability to design a flow control from top to bottom.
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
Meaning if it was not misused there is no issue?
The only times it should ever be used are of the most rarest situations.
So don't get any ideals about using in substitution of well planned logic.
MosaicFuneral
Posting Virtuoso
1,691 posts since Nov 2008
Reputation Points: 888
Solved Threads: 116