title: Having the parameters of a matrix be read in?
body: <p>So part of my homework is to write a program where the parameters of a 2D array are read in.</p>
  
  <p>This is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #define ROWCAP 100
  #define COLCAP 100
  using namespace std;
  void readValues(int x, int y, double matrix[x][y]);
  void printValues(int x, int y, double matrix[x][y]);
  int main() {
      int row;
      int cols;
  
      cout&lt;&lt;"Enter the number of rows: ";
      cin&gt;&gt;row;
      while(row&gt;ROWCAP){
          cout&lt;&lt;"Number is too large, try again: ";
          cin&gt;&gt;row;
      }
      cout&lt;&lt;"Enter the number of columns: ";
      cin&gt;&gt;cols;
      while(cols&gt;COLCAP){
          cout&lt;&lt;"Number is too large, try again: ";
          cin&gt;&gt;cols;
      }
      double matrix[row][cols];
      cout&lt;&lt;"Enter the matrix: \n";
      readValues(row,cols,matrix[row][cols]);
      cout&lt;&lt;"\nThe matrix entered was:\n";
      printValues(row,cols,matrix[row][cols])
      return 0;
  }
  
  void readValues(int x, int y, double matrix[x][y])
  {
      for(int i=0; i&lt;x; i++)
      {
          for(int j=0; j&lt;y; j++)
          {
              cin&gt;&gt;matrix[i][j];
          }
      }
  }
  
  void printValues(int x, int y, double matrix[x][y])
  {
      for(int i=0; i&lt;x; i++)
      {
          for(int j=0; j&lt;y; j++)
          {
              cout&lt;&lt;matrix[i][j]&lt;&lt;"\t";
          }
          cout&lt;&lt;endl;
      }
  }
  </code></pre>
  
  <p>These are the errors:</p>
  
  <pre><code>error: 'matrix' declared as array of references of type 'double &amp;'
  void readValues(int x, int y, double &amp;matrix[x][y]);
  </code></pre>
  
  <p>I've been stuck on this for three hours. What am I doing wrong?<br>
  P.S. Can only use iostream</p>