+ 2
why do we use..........Return 0
8 ответов
+ 6
Technically, in C or C++ main function has to return a value because it is declared as "int main" which means "main function should return integer value or data type"
It's good practice to use it.
+ 3
it means that the compiler has compiled the program normally, if there is any other value other than 0 it means it has compiled abnormally.
+ 3
main is a function where the program begins. it had to report the OS how the program is executed.
+ 2
It acts as an error code. 0 means no error.
+ 1
return 0 is used to terminate the main function
0
It tells the compiler every thing is okay.
Try " return 3" and see what happens
0
it is used to terminate the program..as u know 0 is false and 1 is true ..and when u return the value 0 to main ..it will be terminated
0
I tried it on code: :blocks