title: return subsets of an array using recursion c++
body: <p>Hi Guys I been stuck on a problem for quite a while now -
  Here it is - </p>
  
  <blockquote>
    <p>question --- given an array of size n ,find and return all subsets of this 
                 array .... do this recursively</p>
  </blockquote>
  
  <p><strong>My approach</strong> - consider an array of size 3 - {10,11,12}. Consider 1st element - I have 2 options to either take it not. So I do work for 1st element and let recusion do the rest. </p>
  
  <pre><code>int helper(int in[],int si,int n,int output[][20]){
                         //si - starting index , n  - size
    if(si == n){
      output[0][0] = 0;        //using 0 for null
      return 1;               //helper returns the number of subsets of array 
    }
  
    int smallSize = helper(in,si+1,n,output);
    for(int i =0;i&lt;smallSize;i++){
      output[i+smallSize][0] = in[si];        
      for(int k = 0;k&lt;4;k++){
        output[i+smallSize][k+1] = output[i][k];
      }
    }
    return smallSize*2;
  }
  
  int subset(int input[], int n, int output[][20]) {
    return helper(input,0,n,output);
  }
  </code></pre>
  
  <p>I want to store all the subsets in 2-d array output and return the number of subsets.</p>
  
  <p>I seem to get zeros?</p>