- 4
What is cout and function of return 0;
8 Answers
+ 3
In C++ main function, the return statement is used to return the "Exit status" of the program, to its caller, in the case program is compiled into an executable, the program's main function is called by the O/S shell.
Basically, return 0 indicates a success status, no error, while returning other number indicates that there's something wrong, or, the program found a situation where it has to quit prematurely (not able to finish its entire work).
Hth, cmiiw
+ 2
we use cout to print a value like
cout << "test"
and return 0; returns "False"
+ 1
there are two choices 0 and 1 :
1 means true
0 means false
you can return them when you want
and also if the variable has a value then it's 1
and if he contain nothing then it's 0 !
+ 1
and you can return numbers like return 3
+ 1
thanks a lot friend
+ 1
and i forgot , you can return anything you ,
and to print the returned value you should
use cout <<
it will not be printed by itself like cout<< "test"
0
OK but what if we write return 3