+ 13
If you are talking about an arbitrary function's return then I have an example for you. int func(double x); // This is a function prototype .... int main() { ... double pi = 3.14; cout << func(pi); ... } // This is function definition int func(double x) { if (x > 0) return 0; // here, 3.14 > 0 then 0 is gonna return to caller and 0 prints out. else return 2 + 2 // if you pass a negative number, then 2 + 2 = 4 will return and you'll see 4 in the console }
3rd Oct 2017, 4:17 PM
Babak
Babak - avatar