title: How can I modify a 2d array passed to a function?
body: <p>Why does the following code give me a segmentation fault?</p>
  
  <pre><code>#define MAXROWS 10
  #define MAXCOLS 10
  void getInput (int *data[MAXROWS][MAXCOLS]) {
    int rows, cols;
    int curRow, curCol;
    printf ("How many rows and cols?");
    scanf ("%d %d", rows, cols);
  
    for (curRow = 0; curRow &lt; rows; curRow++) {
      for (curCol = 0; curCol &lt; cols; curCol++) {
        scanf ("%d", data[curRow][curCol]);
        printf ("%d\n", *data[curRow][curCol]);
      }
    }
  }
  
  void main () {
    int data[MAXROWS][MAXCOLS];
  
    getInput (data);
  }
  </code></pre>
  
  <p>It seems to be that the <code>scanf</code> and <code>printf</code> statements aren't getting the right data type passed in, but I can't work out what they <em>should</em> be.</p>
  
  <p>How can I change it so that it works properly?</p>