#include <iostream>
using namespace std;

void f(int i)
{
    // local variables increase the size of the functions activation record
    // thus increasing how much room a call to this function needs on the 
    // stack
    // int buf[1000];
    int a;
    if (i % 100000 == 0)
    {
        cout << "f(" << i << ") called" << endl;
        // the following shows that activation records are allocated
        // from high to low memory -- that the stack grows from high
        // to low memory
        cout << "&a = " << &a << endl;
    }
    // int *ptr = new int[1000];
    f(i + 1);
}

int main()
{
    f(0);
}

