+ 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.

5th Oct 2016, 6:07 PM
Devansh Kaushik
Devansh Kaushik - avatar
2 Réponses
+ 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.
5th Oct 2016, 7:17 PM
Mohammed Maaz
Mohammed Maaz - avatar
0
thanks mohammad maaz... appreciate your help.
6th Oct 2016, 5:08 PM
Devansh Kaushik
Devansh Kaushik - avatar