title: C++ - Returning a 2D array through function
body: <p>I've looked around trying to figure out if I should return a 2D array in C++, but got mixed answers.</p>
  
  <p>Some of the answers say <em>no</em> because the data is local to the function and when it returns, the array points to "junk data" (as it can be overwritten at any time). However, some said <em>"yes, return it like a normal array."</em></p>
  
  <p><strong>So, to my dilemma:</strong></p>
  
  <p>I have a 2D array that holds pointers to <code>Tile</code> objects</p>
  
  <p><code>Tile* map[128][128];</code></p>
  
  <p>Should I return the array in a function? Why or why not? If the answer is yes, how would I do that?</p>
  
  <p>EDIT: I was unclear. I want to make a getter method to return the map variable and be able to use the pointers in the array in another function.</p>