title: Why passing 2D matrix gives error in C?
body: <p>I have written this below simple code to demonstrate passing 2D matrix in C. I have gone through most of the online articles. And this code is inaccordance with those suggested approaches. But still I am getting a compile error. Please explain. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int max = 0;
  
  void maxId(int i,int j, int p[8][12]){
  
  
  }
  
  int main(){
      int m = 8;
      int n = 12;
      int p[m][n] = {{0,1,1,0,1,0,0,0,1,1,1,0},
                   {0,1,1,0,1,0,0,0,1,1,1,0},
                   {0,0,1,0,1,0,0,0,1,1,1,0},
                   {0,1,0,0,1,1,1,0,1,1,1,0},
                   {0,0,1,0,1,0,1,0,1,1,1,0},
                   {0,0,1,0,1,0,1,0,1,1,1,0},
                   {0,1,0,0,1,1,0,0,1,1,1,0},
                   {0,0,1,0,1,0,0,0,1,0,1,1}};
  
      int v[m][n];
  
      for(int i= 0;i&lt;m;i++)
          for(int j = 0;j&lt;n;j++){
              v[i][j] = v[i][j];
          }
  
      maxId(0,0,p);
      return 0;
  }
  </code></pre>
  
  <p><strong>Updated</strong></p>
  
  <p>The compile error shown is </p>
  
  <blockquote>
    <p>29    13  C:\Users\RainDrop\Documents\devc++
    projects\Untitled2.cpp    [Error] cannot convert 'int (<em>)[n]' to 'int
    (</em>)[12]' for argument '3' to 'void maxId(int, int, int (*)[12])'</p>
  </blockquote>