why we use return in this prog. #include <iostream> using namespace std; int timesTwo(int x) { return x*2; } in | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

why we use return in this prog. #include <iostream> using namespace std; int timesTwo(int x) { return x*2; } in

16th Sep 2016, 7:45 AM
Mayur Patil
Mayur Patil - avatar
1 Resposta
+ 1
The function parameters here are passed by value. If you don't use return, your function won't do anything.
16th Sep 2016, 8:47 AM
Zen
Zen - avatar