Je veux multiplier les matrices. Je crée la matrice par malloc()
fonction. Index (variable nommée i
) montre NULL
, au lieu du numéroindex montre NULL à l'intérieur pour la boucle
int** matrix_a = (int**)malloc(lines * sizeof(int*));
for (int i = 0; i < lines; i++) {
if (i == NULL)
printf("'i' is NULL!");
matrix_a[i] = (int*)malloc(trans * sizeof(int*));
}
Sortie:
'i' is NULL!
Erreur:
Unhandled exception at 0x00007FF6003C35BB in MPI_C.exe: 0xC0000005: Access violation writing location 0xFFFFFFFFABA57A00.
Que voulez-vous accomplir avec 'i == NULL'? – pzaenger
Une langue propre serait appréciée. –
Ne pas lancer le résultat de 'malloc()'. – melpomene