0

Returning Function values.

How do you pull the return value from a function using a function call.

21st Apr 2017, 4:03 PM
Sasquatch
Sasquatch - avatar
1 Answer
+ 24
float average(int a, int b){ return a+b/2.0; } int main(){ float avg = average(3,7); // save in another variable cout<<avg; // or directly print the value cout<<average(10,5); }
21st Apr 2017, 4:37 PM
Shamima Yasmin
Shamima Yasmin - avatar