+ 2
What happens if we dont return 0
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.
+ 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.
0
thanks
- 1
if you don't return the answer, the program not run.