Basically,
In CC++ Programming the function call work on Stack Segment in Memory.See Here
and in your program you are calling function recursively.
return ((8*a(n-1)*a(n-1)-1)/a(n-2));
at this stage for input n = 8
The function all will be
for a(8)->(8*a(7)*a(7)-1)/a(6)))
for a(7)->(8*a(6)*a(6)-1)/a(5)))
for a(6)->(8*a(5)*a(5)-1)/a(4)))
for a(5)->(8*a(4)*a(4)-1)/a(3)))
for a(4)->(8*a(3)*a(3)-1)/a(2)))
for a(3) program will return (8*49-1)/1
for a(2) program will return (7)
These all function will get its own stack segment in stack memory.
And the stack segment as it works on LIFO.
the stack segment will be from Last a(8)->a(7)->a(6)->a(5)->a(4)->a(3)->a(2) and it depends on the compiler`s function calling methodology so stack segment function calling may vary.
hope this will help you to understand.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…