title: C : recursively defined program to calculate determinant of a matrix
body: <p>I cannot understand why this program is producing wrong determinant values for matrices. This program uses the recursive calls to the function func() which converts the argument matrix to its minor which is then ultimately reduced to a single element. Please help, What is the error in this code..??</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;math.h&gt;
  void display_(int arr[][4])
  {
      int i,j;
      putchar('\n');
      for(i=0;i&lt;4;i++)
          {for(j=0;j&lt;4;j++)
              printf("%d\t",arr[i][j]);
          printf("\n");
          }
  }
  int func(int arr[][4],int i,int j,int order)
  {
      if(order==1)
          return arr[0][0];
      return(pow(-1,i+j)*arr[i][j]*func(arr,i+1,j+1,order-1));
  }
  int main()
  {
      int i,j,matrix[4][4];
      printf("\nEnter the elements to the matrix : ");
      for(i=0;i&lt;4;i++)
          for(j=0;j&lt;4;j++)
              scanf("%d",&amp;matrix[i][j]);
      display_(matrix);
      printf("\nDeterminant : %d",func(matrix,0,0,4));
  }
  </code></pre>