What will happen if i return other than 0? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What will happen if i return other than 0?

3rd Feb 2017, 4:29 AM
Rahul Sk
Rahul Sk - avatar
2 Answers
+ 7
"The return value for main should indicate how the program exited. Normal exit is generally represented by a 0 return value from main. Abnormal termination is usually signalled by a non-zero return but there is no standard for how non-zero codes are interpreted. ... It's also worth noting that in C++, int main() can be left without a return value at which point it defaults to returning 0." Source: http://stackoverflow.com/a/204483
3rd Feb 2017, 4:53 AM
Jafca
Jafca - avatar
+ 1
Nothing, once return 0 is read by the processor the program terminates.
3rd Feb 2017, 4:55 AM
Cam Rakes