title: Difference between backtracking and recursion?
body: <p>What is the difference between backtracking and recursion?  How is this program working?</p>
  <pre><code>void generate_all(int n)
  {
      if(n&lt;1) printf(&quot;%s\n&quot;, ar);
      else{
              ar[n-1]='0';        //fix (n)th bit as '0'
              generate_all(n-1);  //generate all combinations for other n-1 positions.
              ar[n-1]='1';        //fix (n)th bit as '1'
              generate_all(n-1);  //generate all combinations for other n-1 positions.
      }
  }
  </code></pre>