title: C++ - Return multidimensional array from function
body: <p>I am writing a code for Cellular Automata and I need an evolution function to calculate the state of the automata after a time step.
  I choose to call this function evol, to test it I created an elementary function in C++. Unfortunately it does not compile since the compiler cannot understand that I need it to return an array. Here is the code :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  #include &lt;vector&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  const int N = 51; // Size of the grid; two columns/rows are added at the beginning and the end of the array (no evolution of the CA on the boundaries)
  
  class Cell{
      //defining whats a cell here        
  };
  
  void showCA(Cell CA[N+2][N+2]){
      //function to print the CA grid in the terminal         
  }
  
  
  Cell[N+2][N+2] evol(Cell CA[N+2][N+2]){
      return CA;
  }
  
  int main()
  {
       // Initialisation
      cout &lt;&lt; "Initialisation" &lt;&lt; endl;
      static Cell CA[N+2][N+2];
      // some code here to initialize properly the Cell array.
      showCA(CA);
      CA = evol(CA);
      showCA(CA);
      return 0;
  } 
  </code></pre>
  
  <p>The compiler returns this error :</p>
  
  <pre><code>error: expected unqualified-id
  Cell[N+2][N+2] evol(Cell CA[N+2][N+2]){
  </code></pre>
  
  <p>Any idea on how I should implement this ? </p>