Wat is the defrent between (1. Return by value/ 2. Return by refrence /3. Return by constant refrence ) in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Wat is the defrent between (1. Return by value/ 2. Return by refrence /3. Return by constant refrence ) in c++

function return types in c++

24th Feb 2017, 10:52 AM
Muhammad Xoshnaw
Muhammad Xoshnaw - avatar
1 Answer
+ 1
return by value the variable passed in the function can change within but when returned it will be the same as it was enter in the function. return by reference the variable passed in by reference could change within the function. if it does then that is what it will end up being after the function call. return by const usually only used within classes to get a pmv this mean that Nothing can change within the function. it will only return one value
3rd Mar 2017, 8:33 AM
Michael Szczepanski
Michael Szczepanski - avatar