+ 3
What does return 0; means and where to use it ?
return 0;
19 Answers
+ 1
Usually, zero is returned to the calling function when the program was executed successfully.
+ 1
If your function is of type int, then it must always return some value:
int main()
{
// some expression
return 0;
}
+ 1
//This function is not zero:
#include <iostream>
using namespace std;
int timesTwo(int x) {
return x*2;
}
int main() {
cout << timesTwo(8) << endl;
cout <<timesTwo(5) << endl;
cout <<timesTwo(42) << endl;
}
+ 1
That should return a function of determines the author of the program.
+ 1
A function of type "int" ALWAYS returns an integer value. If you do not write "return" the function will still return some value. If you write "return", it will allow you to control this value (what are you waiting for ...) You can use a function like "void" if you do not need a return value from a function
+ 1
This means to get desired results it's important to write funcfion type integer. Operator "return" shows only that this function returns. It is important to remember: a function of type integer always returns some value
+ 1
In other words, this is the command for the program
+ 1
its not something you need to be concerned with, its just ends the program after it has executed
0
what does this means?
0
why 0 not something else ?
0
Then what does 0 means and where to use that 0 ?
0
Usually return value contains code of error. 0 means that function completes without error.
0
this means there is no need to write return 0; or return result; or return a*b*c and so on anywhere?
0
this means to get desired results it's important to write return //something
0
explain what the operator return actually means?
0
some time we have to write return 0; and some time return" variable" ; Please explain this to me?