title: How to use a static variable to hold state within a recursive function
body: <p>I've written the following toy function to see how the stack grows downwards on recursive function calls and then unwinds on returns:</p>
  <pre><code>void countdown(int n) {
  
      // trying to get initial address so the math is a bit simpler 
      // on how much the stack grows down/up
      static intptr_t initial_address = (intptr_t) &amp;n;
  
      if (n!=0) {
          printf(&quot;%d...at address: %p\n&quot;, n, &amp;n);
          countdown(n-1);
          printf(&quot;%d...at address: %p\n&quot;, n, &amp;n);
      } else 
          printf(&quot;Liftoff!\n&quot;);
  }
  </code></pre>
  <p>Is there a way to do something like this without passing another argument to the <code>countdown</code> function? If so, what would be the proper way to do this?</p>