+ 1
Why return 0; is mostly used in C?? Is there any specific reason behind this?
2 Answers
+ 4
https://www.sololearn.com/discuss/1875406/?ref=app
https://www.sololearn.com/discuss/797593/?ref=app
https://www.sololearn.com/discuss/618623/?ref=app
https://www.sololearn.com/discuss/22983/?ref=app
https://www.sololearn.com/discuss/2224109/?ref=app
https://www.sololearn.com/discuss/885457/?ref=app
+ 1
With the new standard of C
return 0;
Is not required for main()
int main(void) {
some code;
}
Is valid (given your code is valid).
The reason 0 was used it's the only number that does not have a positive and negative value thus has only a single state. Return 0 was defined as success to main.