+ 1

what if we end program with return 1;

why do we end program with return 0; why don't anything else

2nd Sep 2016, 4:05 PM
Ankit Ojha
Ankit Ojha - avatar
3 Antworten
+ 2
nothing.. its the same
2nd Sep 2016, 4:25 PM
Soutik
Soutik - avatar
+ 2
If your program returns a non-zero value, you mean to indicate some kind of error. If you launched the program by itself, it doesn't really matter, but if you launched it with a script, it gets the return value, and you can deduce the error from the number returned and do stuff depending on it. Which return value indicates which error is entirely of your choosing.
2nd Sep 2016, 5:23 PM
Zen
Zen - avatar
+ 2
Yes..... nothing will happen. you can return any value to a function.
2nd Sep 2016, 6:11 PM
Piyush Yadav
Piyush Yadav - avatar