+ 1

What means return?

what is return doing in this function int func(int a, int b){ return a + b; }

13th Apr 2017, 10:34 PM
Elias
Elias - avatar
3 Réponses
+ 3
https://www.sololearn.com/discuss/151634/?ref=app the function behaves as the value it returns . for example you can do int a = func(3,3) + 2; cout<<a; output 8.
13th Apr 2017, 10:41 PM
Sandeep Chatterjee
+ 2
as the name says itself, it returns the value of a variable, or operation. if you call the function like: func(2,3); and inside it say return a + b, the return value will be 5.
13th Apr 2017, 10:36 PM
Welliton Malta
Welliton Malta - avatar
0
It means you substitute every call of that function for the value it returns.
14th Apr 2017, 1:05 AM
Denis Felipe
Denis Felipe - avatar