title: Passing two-dimensional array to a function by refrence (C Programming)
body: <p>I'm learning pointers, and gotten stuck for an hour now, with this code,</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int determinant(int **mat)  /* int mat[3][3] works fine.. int *mat[3] doesn't.. neither does int *mat[] */
  {
      int det;
      int a=*(*(mat+0)+0); // printf("\n%d",a);
      int b=*(*(mat+0)+1); // printf("\n%d",b);
      int c=*(*(mat+0)+2); // printf("\n%d",c);
      int d=*(*(mat+1)+0); // printf("\n%d",d);
      int e=*(*(mat+1)+1); // printf("\n%d",e);
      int f=*(*(mat+1)+2); // printf("\n%d",f);
      int g=*(*(mat+2)+0); // printf("\n%d",g);
      int h=*(*(mat+2)+1); // printf("\n%d",h);
      int i=*(*(mat+2)+2); // printf("\n%d",i);
  
      det = a*(e*i-h*f) - b*(d*i-g*f) + c*(d*h-e*g);
      return det;
  }
  
  int main()
  {
      int mat[3][3];
      int i,j;
      printf("Enter the 3 X 3 matrix:\n\n");
      for (i=0;i&lt;3;i++)
      {
          for (j=0;j&lt;3;j++)
          {
              scanf("%d",*(mat+i)+j);
          }
      }
      printf("\nThe determinant of the given 3 X 3 matrix is %d",determinant(mat));
      return 0;
  }
  </code></pre>
  
  <p>I don't think anything is wrong with the function call. Maybe the problem is while accepting the arguments. Idk, isn't <code>mat</code> a pointer to an 1-dimensional array, which would again be a pointer to the array element, making <code>mat</code> a pointer to a pointer?
  When I print some text at places (just to check), i find that the execution goes till after <code>int det</code> in the function, and the program crashes in the next step.
  <code>mat [3][3]</code> works well, but i wanna use some <code>*</code> there, because as i said, i'm 'learning'..</p>
  
  <p>Please help!
  Thanks :)</p>