title: main.c: warning: passing argument of ‘’ from incompatible pointer type
body: <p>I'm trying to pass and return a two-dimension dynamic array by parameter, however it always shows this warning I mentioned in the question. I know there's something wrong with the array parameter, but I couldn't find in any book or a website how to properly pass an array whose dimensions change. I've read similar questions to mine about the warning and it's mostly about adding a <code>&amp;</code> in your pointer, which I haven't added in mine.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  void fun(int m, int n, int (*arr)[n]);
  
  int main(void) {
      int i, j, m, n, **arr;
      printf("Enter the dimensions m, n\n");
      scanf("%d %d", &amp;m, &amp;n);
      arr = (int **)malloc(m * sizeof(int *));
      for (i = 0; i &lt; m; i++) {
          arr[i] = (int *)malloc(n * sizeof(int));
      }
      fun(m, n, *arr);
      printf("\n\n");
      for (i = 0; i &lt; m; i++) {
          for (j = 0; j &lt; n; j++) {
              printf("%5d", arr[i][j]);
          }
          printf("\n");
      }
      if (arr == NULL) {
          exit(1);
      } else
      if (arr != NULL) {
          free(arr);
      }
      return 0;
  }
  
  void fun(int m, int n, int (*arr)[n]) {
      int i, j, k = 0;
      for (i = 0; i &lt; m; i++) {
          for (j = 0; j &lt; n; j++) {
              k = k + 1;
              arr[i][j] = k;
          }
      }
  }
  </code></pre>