title: passing array to recursive function
body: <p>i want to pass array to recursive function , but i need to keep all the arrays </p>
  
  <p>output :</p>
  
  <pre><code>1 0 0 0 0 
  1 2 0 0 0 
  1 2 3 0 0 
  1 2 3 0 0 
  1 2 3 0 0
  </code></pre>
  
  <p>when i return to the previous step i want to use array : 1 2 0 0 0</p>
  
  <p>second return : 1 0 0 0 0</p>
  
  <p>not this one : 1 2 3 0 0</p>
  
  <p>my goal is to see output like this</p>
  
  <pre><code>1 0 0 0 0 
  1 2 0 0 0 
  1 2 3 0 0 
  1 2 0 0 0 
  1 0 0 0 0
  </code></pre>
  
  <p>.</p>
  
  <pre><code>    #include&lt;iostream&gt;
      using namespace std;
      int a[100];
      void go (int a[100],int x)
      {
           a[x]=x;
           for(int i=1;i&lt;=5;i++)cout&lt;&lt;a[i]&lt;&lt;" ";cout&lt;&lt;endl;
           if(x==3)return;
             go(a,x+1);
          for(int i=1;i&lt;=5;i++)cout&lt;&lt;a[i]&lt;&lt;" ";cout&lt;&lt;endl;
      }
      main()
      {
           go(a,1);
      }
  </code></pre>
  
  <p>it uses only 1 array :/ i need it to create another arrays 'a' and when it returns  to previous step not to use the last array but the one which was remembered on that step</p>
  
  <p>please help :(</p>