"projet".exe cessé de fonctionner

Fermé
etrioumaima Messages postés 1 Date d'inscription jeudi 19 novembre 2015 Statut Membre Dernière intervention 10 décembre 2015 - Modifié par etrioumaima le 10/12/2015 à 16:47
Bonjour, j'utilise CodeBlocks
Quand j’exécute mon programme je saisie la 1er matrice et quand je viens de saisir la deuxième nombre se message se lance "projet".exe cessé de fonctionner...
voici mon code :
#ifndef M_OPERATION_H_
#define M_OPERATION_H_

#include <stdio.h>
#include <stdlib.h>

typedef struct matrice {
 int** data;
 int n ;
} matrice;

matrice* initialize() {
 matrice* m = (matrice*)malloc(sizeof(matrice));
 m->n = 5;
 m->data = (int**)malloc((m->n)*sizeof(int*));
 int i;
 for(i = 0 ;i<m->n; ++i)
  m->data[i] = (int*)malloc(sizeof(int));
 return m;
}

matrice* read_matrice(int base)
{
 matrice* m = initialize();
 int i,j;
 for(i = 0; i < 5 ; ++i) {
  printf("taper les valeurs de la ligne %d\n",i);
  for(j = 0 ; j < 5 ; ++j)
  {
   printf(" m[%d][%d] ",i,j);
   char tmp[7];
   scanf("%s",&tmp);
   m->data[i][j] = to_dec(tmp,base);
  }
 }
 return m;
}
void print(matrice* m, int base) {
 int i,j;
 printf("resultat : \n");
 for(i = 0; i < 5 ; ++i) {
  printf("\n");
  for(j = 0 ; j < 5 ; ++j)
  {
   printf("%s \t",convert_(m->data[i][j],base));
  }
 }
}

matrice* m_addition_(matrice* m1, matrice* m2) {
 matrice* m = initialize();
 int i,j;
 for(i = 0 ; i < m->n ; i++)
  for(j = 0 ; j < m->n ; j++)
  {
   m->data[i][j] = m1->data[i][j] + m2->data[i][j];
  }
 return m;
}
matrice* m_multiplication_(matrice* m1, matrice* m2) {
 matrice* m = initialize();
 int i,j,k;
 for(i = 0 ; i < m->n ; i++)
 {
  for(j = 0 ; j < m->n ; j++)
  {
   m->data[i][j] = 0;
   for( k = 0 ; k < m->n ; k++)
   {
    m->data[i][j] += (m1->data[i][k])*(m2->data[k][j]);
   }
  }
 }
 return m;
}
void release(matrice* m)
{
 free(&(m->data));
}

#endif /* M_OPERATION_H_ */

EDIT : Ajout des balises de code (la coloration syntaxique).
Explications disponibles ici : ICI

Merci d'y penser dans tes prochains messages.
A voir également: