Skip to content
Extraits de code Groupes Projets
Valider b5a26df2 rédigé par Anteunis Charles's avatar Anteunis Charles
Parcourir les fichiers

check mallocs

parent ed3c2fc0
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -39,9 +39,18 @@ int main(int argc, char const *argv[]) ...@@ -39,9 +39,18 @@ int main(int argc, char const *argv[])
} }
height = height/10; height = height/10;
/* initialisation de la matrice */
matrix = (char **) malloc(height*sizeof(char *)); matrix = (char **) malloc(height*sizeof(char *));
if (matrix == NULL) {
printf("Error malloc");
exit(1);
}
for (i=0 ; i<height ; i++) { for (i=0 ; i<height ; i++) {
matrix[i] = (char *) malloc(width*sizeof(char)); matrix[i] = (char *) malloc(width*sizeof(char));
if (matrix[i] == NULL) {
printf("Error malloc");
exit(1);
}
} }
i = 0; i = 0;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter