What's the difference between typing in return 0; or return 1; at the end of a program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the difference between typing in return 0; or return 1; at the end of a program?

3rd Oct 2016, 9:24 PM
Shyam
Shyam - avatar
3 Answers
0
Any other number than 0 signifies an error occurred.
3rd Oct 2016, 10:55 PM
Mythos
0
If you return anything different from 0 (in int main) you are telling the program (e.g. the operating system) that is executing your program that something went wrong. An error has occurred.
3rd Oct 2016, 11:03 PM
marcram
0
return 1 is used in recursive functions..
4th Dec 2016, 2:51 PM
HaMmII
HaMmII - avatar