- 2
What is the return value of the call start () ?
int func2(int w) { return w*3 } int func1 (int a, int b) { int n = a+b; return 2 + func2 (n) ; } int start () { int z = 4; return func1 (z, 1) -3; }
3 Answers
+ 3
Please tag a specific language, don't write a sentence, question or plea in the thread's tags : )
+ 1
I think the answer is 14
In start,
func1(4,1)
in func1
n=5
return 2 + func2(5)
In func2,
func2 will return 15 to func1
now func1 will return 17 to start
and start will return 14 to main function.
Like Ipang said,use appropriate tag before posting any question:
https://www.sololearn.com/discuss/1316935/?ref=app
https://www.sololearn.com/post/75089/?ref=app
https://www.sololearn.com/post/52212/?ref=app
0
func1(4, 1) -3; [ =>func1(4,1)=2+func2(n); n=4+1]
2+ func2(5) - 3; [ => func2(5) = 5*3 =15 ]
2 + 15 - 3
=14