title: C++ How to make a 2D Vector function?
body: <p>I'm trying to create a function in C++ that returns a 2D vector.
  The function also has a 2D vector as argument, the idea would be to return a modified version of this 2D vector, with the function. </p>
  
  <p>I won't put my whole code here as is would be totally off the question, but to sum up the function looks like this :</p>
  
  <pre><code>using std::vector;
  
  vector&lt;vector&lt;char&gt; &gt; function(vector&lt;vector&lt;char&gt; &gt; grid) {
  
      int width = static_cast&lt;int&gt;(grid.front().size());
      int height = static_cast&lt;int&gt;(grid.size());
  
      for(int y=0; y &lt; height; ++y) 
      {
          for(int x=0; x &lt; width; ++x) 
          {
              grid[y][x]= 'H';
          }
      }
      return grid;   
  }
  </code></pre>
  
  <p>And I would then do in the <strong>main</strong> :</p>
  
  <pre><code>vector&lt;vector&lt;char&gt; &gt; new_grid = function(grid);
  </code></pre>
  
  <p>But it doesn't work in the way I'm using it, so I have a few questions :</p>
  
  <ol>
  <li>Should the 2D vector function size be initialized ?</li>
  <li>Can I change the size of <code>grid</code>inside the function and return a bigger 2D vector ?</li>
  <li>And, it might be a dumb question but, is it actually possible to retrieve a value, an array, a string, in a function without using return, in a void function ? </li>
  </ol>
  
  <p>Thanks for your help !</p>
  
  <p>I can show my whole code if you want but it is quite big and might not be so clear.</p>