I was reading about recursive functions....I found something not well answered in my text books....

In the recursive function of fibonacci numbers....I used the following code....

So when I was trying to find the value of fib(4), I noticed that fib(4) is calling fib(3) and fib(2). Again fib(3) is calling fib(2) and fib(1). My query is, in case of the two calls, are both fib(2)'s being called from the same function address???

In the recursive function of fibonacci numbers....I used the following code....

Code: CPP

int fib(int n)

{

if(n==1||n==0)

return(1);

else

return(fib(n-1)+fib(n-2));

}

So when I was trying to find the value of fib(4), I noticed that fib(4) is calling fib(3) and fib(2). Again fib(3) is calling fib(2) and fib(1). My query is, in case of the two calls, are both fib(2)'s being called from the same function address???

*Last edited by back from retirement; 3Dec2008 at 15:27..*