+ 1

Why is it important to include return 0? What happens for other values other than 0?

14th Jun 2016, 4:28 PM
Green Turtle
Green Turtle - avatar
6 Answers
+ 2
it must return something,so since 0 is nothing it's practically like void , but if you do want it to return something you can make it return the result to the main operation (assuming you have something in the main like "addNumbers (x,y)" then in addNumbers() you can do the math than it will return x+y) If you didn't got it just continue the tutorials and you will see later what I'm talking about
16th Jun 2016, 6:46 PM
Alex Ban
Alex Ban - avatar
+ 1
no other values do not process errors it is just a convention to return 0 because 0 is nothing in cpp so if there are not any errors u get nothing
14th Jun 2016, 5:21 PM
Sardor
Sardor - avatar
+ 1
I'm pretty sure it can also return a NULL value
16th Jun 2016, 6:48 PM
Alex Ban
Alex Ban - avatar
0
I think values other than zero would return an error.
14th Jun 2016, 4:52 PM
Karim Adel
Karim Adel - avatar
0
there two of them "0" and "1". "0" will take it to the into main and 1 is abnormal
14th Jun 2016, 5:02 PM
Numan Numan
Numan Numan - avatar
0
no.... I just tested they don't give you an error
14th Jun 2016, 5:03 PM
Alex Ban
Alex Ban - avatar