+ 2

What happens if we dont return 0

8th Sep 2016, 10:53 AM
TrollSmashXD
TrollSmashXD - avatar
4 ответов
+ 4
Nothing, most of the time. You should still put it anyway. The return value of a program is only used when it has been launched by another program (a batch script for example). A return value of 0 indicates that the program terminated without error. If you make your program return a non-zero value (1 for example), you mean to indicate some kind of error. What return value corresponds to which error is entirely of your choosing. You can then act differently in the program that called your program depending on that return value.
8th Sep 2016, 11:15 AM
Zen
Zen - avatar
+ 3
If you are using int data type with main() then you have to return some value...and if you fail to put return then implicitly the compiler will put return into it and give you a warning. It return value 0 to the calling process and signals that it is a normal termination.
2nd Feb 2017, 5:52 AM
Ashu Bagul
Ashu Bagul - avatar
0
thanks
8th Sep 2016, 11:15 AM
TrollSmashXD
TrollSmashXD - avatar
- 1
if you don't return the answer, the program not run.
10th Oct 2016, 12:02 PM
Felipe Idrobo
Felipe Idrobo - avatar