Home Segments Index Top Previous Next

227: Mainline

There is also no danger that the values taken on by the parameter n will get in one another's way. Each time recursive_power_of_2 is entered, C sets aside a private storage spot to hold the value of n for that entry:

                                          Each function call has an 
                                          independent value for n 
First call to recursive_power_of_2 ----*      | | | | 
|                                      |  <---* | | | 
*--------------------------------------*        | | | 
                                                | | | 
Second call to recursive_power_of_2 ---*        | | | 
|                                      |  <-----* | | 
*--------------------------------------*          | | 
                                                  | | 
...                                       <-------* | 
                                                    | 
Final call to recursive_power_of_2 ----*            | 
|                                      |  <---------* 
*--------------------------------------*