Find the output

Consider the following ‘rec’ function.

The value returned by rec (5) is __________ .

4Comments
Polukanti Gouthamkrishna @polukantigou
11 Nov 2017 11:41 pm

240??

 

Niket Gangwar @niket151194
12 Nov 2017 10:14 am

240.... as static variables do have only one copy ,thus while in the process of returning from the topmost activation record of the stack to the lower records the value of variabe is going to be changed and the most recent value will be seen by every remaining record in the recursion stack...

Vijay kumar @avvcreations
12 Nov 2017 11:54 am

120

shashank baranwal @shanky00
12 Nov 2017 05:29 pm

240

Pages