Bonjour,

Je souhaiterai savoir si l'affectation est bien comme ceci (pour tabA[0]), car quand je libère à la fin, j'ai une erreur de segmentation :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
size_t l;
  // pas de control sur malloc() et de free() pour l'exemple
  char **tabA = malloc(3 * sizeof *tabA);
  for (l = 0; l < 3; l++)
      tabA[l] = malloc (10+1 * sizeof *tabA[l]);
 
  tabA[0] = "Bonjour";
  printf("\ntabA[0] -> %s", tabA[0]); // Bonjour