title: Generate All Strings of ‘n’ bits. Assume A[0….n-1] be an array of size n
body: <pre><code>void binary(int n)
  {
      if(n &lt; 1)
          printf(&quot;%s\n&quot;,A);    // Assume A is a global variable
      else
      {
          A[n-1] = '0';
          binary(n-1);
          A[n-1] = '1';
          binary(n-1);
      }
  }
  </code></pre>
  <p>Can anyone please explain the stack frames for <code>n =</code> 2? I mean when <code>n = 2</code>, I'm getting <code>00</code> when I'm doing a dry run. But there is also a <code>01</code> which I'm missing. Can someone please explain what stack frames are generated for this code?</p>