title: Matrix determinant algorithm C++
body: <p>I'm new to programming and I was looking for a way to find the determinant of a matrix. I found this code online, but I have trouble understanding the algorithm in place here. I have no problems for the base of the recursion , but the continue and main loop I have trouble understanding. Big thanks to anyone who can explain to me the algorithm.</p>
  
  <pre><code>int determ(int a[MAX][MAX],int n) {
    int det=0, p, h, k, i, j, temp[MAX][MAX];
    if(n==1) {
      return a[0][0];
    } else if(n==2) {
      det=(a[0][0]*a[1][1]-a[0][1]*a[1][0]);
      return det;
    } else {
      for(p=0;p&lt;n;p++) {
        h = 0;
        k = 0;
        for(i=1;i&lt;n;i++) {
          for( j=0;j&lt;n;j++) {
            if(j==p) {
              continue;
            }
            temp[h][k] = a[i][j];
            k++;
            if(k==n-1) {
              h++;
              k = 0;
            }
          }
        }
        det=det+a[0][p]*pow(-1,p)*determ(temp,n-1);
      }
      return det;
    }
  }
  </code></pre>