Ajout Fonctions de creation de Matrices
This commit is contained in:
parent
ea8b324ac0
commit
868058896b
@ -52,3 +52,34 @@ void visuelGraphe(graphe g){
|
||||
FermerGraphique();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Aides matrices
|
||||
//Creation matrice carrée vide :
|
||||
int** creerMatriceId(int taille){
|
||||
int** res=malloc(taille,sizeof(*int));
|
||||
for(int i=0;i<taille;i++){
|
||||
res[i]=malloc(taille,sizeof(int));
|
||||
for(int j=0;j<taille;j++){
|
||||
res[i][j]=(i==j)?1:0;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//Creation copie d'une matrice carree :
|
||||
int** recopierMatrice(int **m,int taille){
|
||||
int** creerMatriceId(int taille){
|
||||
int** res=malloc(taille,sizeof(*int));
|
||||
for(int i=0;i<taille;i++){
|
||||
res[i]=malloc(taille,sizeof(int));
|
||||
for(int j=0;j<taille;j++){
|
||||
res[i][j]=m[i][j];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user