title: Recursive function not appending numbers
body: <p>I have been trying to figure out why my recursive function is not returning any numbers. <code>vi</code> is <code>vector&lt;int&gt;</code> and <code>x</code> in the original function call is empty. Everything else is irrelevant (works correctly).  What should be happening is <code>c</code> is pushed back into <code>x</code> and <code>x</code> is returned. The function works fine if have it return nothing and push <code>c</code>s into a global vector. </p>
  
  <pre><code>vi generate(const vvi &amp;paths, int index, int start, int end_, int c, vi x)
  {
      if (start == end_)
      {
          x.push_back(c);
          return x;
      }
  
  
  
      for(auto path : paths)
      {
          if(path[0] == start)
          {
              x = generate(paths, index, path[1], end_, path[index] + c, x);
          }
  
      }
      return x;
  
  }
  </code></pre>
  
  <p>Example:</p>
  
  <p><code>paths</code> is a vector of vector of ints. Here is the structure visualized</p>
  
  <pre><code>{{1, 2, 1, 0},
   {2, 3, 1, 0},
   {1, 3, 1, 0}}
  </code></pre>
  
  <p>Called with <code>generate(paths, 2, 1, 3, 0, x)</code>. The start and end are 1 and 3. C starts at 0. x is an empty vector of ints. </p>
  
  <p>Expected (to clarify, something not empty, order doesn't matter):</p>
  
  <pre><code>{1, 2}
  </code></pre>
  
  <p>First number from path 1 to 3, second number from path 1 to 2 and path 2 to 3. </p>