- 4

What is cout and function of return 0;

17th Sep 2017, 11:43 AM
anshuman shukla
8 Respuestas
+ 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
17th Sep 2017, 1:47 PM
Ipang
+ 2
we use cout to print a value like cout << "test" and return 0; returns "False"
17th Sep 2017, 12:01 PM
New Coder
New Coder - avatar
+ 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 !
17th Sep 2017, 12:04 PM
New Coder
New Coder - avatar
+ 1
and you can return numbers like return 3
17th Sep 2017, 12:05 PM
New Coder
New Coder - avatar
+ 1
thanks a lot friend
17th Sep 2017, 12:05 PM
anshuman shukla
+ 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"
17th Sep 2017, 12:12 PM
New Coder
New Coder - avatar
0
OK but what if we write return 3
17th Sep 2017, 12:02 PM
anshuman shukla