Created
October 4, 2011 13:08
-
-
Save MiLk/1261602 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int** sous_matrice(int** mat, int row, int col, int taille) | |
{ | |
int i, j, k, l; | |
int **new_mat; | |
new_mat = malloc(taille * taille * sizeof (int)); | |
i = 0; | |
k = 0; | |
while (k < taille) | |
{ | |
if (k == row) | |
k++; | |
j = 0; | |
l = 0; | |
while (l < taille) | |
{ | |
if (l = col) | |
l++; | |
new_mat[i][j] = mat[k][l]; | |
j++; | |
l++; | |
} | |
i++; | |
k++; | |
} | |
return new_mat; | |
} | |
int det(int** mat, int taille) | |
{ | |
int i, j, result = 0; | |
if (taille == 1) | |
return (mat[0][0]); | |
else | |
{ | |
for (i = 0; i < taille; i++) | |
{ | |
result += mat[0][i] * det(sous_matrice(&mat, 0, i, taille - 1), taille - 1); | |
} | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment