title: C++ passing Dynamically-sized 2D Array to function
body: <p>I'm trying to figure out how to pass 2D array, which is constructed dynamically to a function.
  I know that number of columns must be specified, but it my case it depends on user input.</p>
  
  <p>Are there any workarounds?</p>
  
  <p>Example:</p>
  
  <pre><code>// Some function
  void function(matrix[i][j]) {
  // do stuff
  }
  // Main function
  int N;
  cout &lt;&lt; "Size: ";
  cin &gt;&gt; N;
  
  int matrix[N][N];
  
  for (int i=0;i&lt;N;i++) { // 
   for (int j=0;j&lt;N;j++) { 
    cin &gt;&gt; matrix[N][N];
   }
  }
  
  sort(matrix);
  </code></pre>
  
  <p>You get the idea :)</p>