+ 1
What do you mean by " a function will perform the desired operations without returning a value" ??
does this mean we won't get a answer.
2 ответов
+ 2
no, it simply means that a function needs not necessarily to return a value. It can achieve the desired results without using return. For example:
string nameWithReturn(string name) // when function used with return
{
return name;
}
void nameWithoutReturn(string name) // when same thing is acheieved //without return
{
cout << name;
}
Both functions will output exactly the same thing, the only difference is that the latter one returns nothing. So the return valt of the first one can be saved in a variable directly but you can't do this for the latter one.
0
thanks mohammad maaz... appreciate your help.