what happens for return 1; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what happens for return 1;

17th Jun 2016, 12:29 AM
Andrew
Andrew - avatar
3 Answers
+ 1
If you're talking about main, when the return is different from 0, it means an error occured. If something happens, and the program has to stop running, then it returns a non-zero value.
17th Jun 2016, 4:24 AM
Alejandro Aristizabal
Alejandro Aristizabal - avatar
+ 1
makes sense so if it ain't zero an error occurred and it has to keep running thanks
17th Jun 2016, 4:30 AM
Andrew
Andrew - avatar
0
there is no difference whether you write return 0 or return 1.the program will run successfully. You can even write return 2 or return 7 whatever you want.
17th Jun 2016, 6:14 AM
sneha
sneha - avatar