+ 2

why do we use..........Return 0

2nd Sep 2016, 2:47 AM
Yogendra C
Yogendra C - avatar
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.
2nd Sep 2016, 2:58 AM
Devangsinh Rathod
Devangsinh Rathod - avatar
+ 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.
2nd Sep 2016, 11:56 AM
Yash Mohta
Yash Mohta - avatar
+ 3
main is a function where the program begins. it had to report the OS how the program is executed.
1st Oct 2016, 2:36 AM
Bhargav
Bhargav - avatar
+ 2
It acts as an error code. 0 means no error.
2nd Sep 2016, 8:48 AM
Zen
Zen - avatar
+ 1
return 0 is used to terminate the main function
6th Sep 2016, 10:54 AM
Khriit De Chavez Mejia
Khriit De Chavez Mejia - avatar
0
It tells the compiler every thing is okay. Try " return 3" and see what happens
4th Sep 2016, 8:19 PM
wess
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
7th Sep 2016, 10:22 AM
Ravi Teja
Ravi Teja - avatar
0
I tried it on code: :blocks
8th Sep 2016, 12:34 AM
wess