Well, I would like to initiate my 2D array by a void function. But I obtain a Segmentation Fault...
That's my code :
#include <stdio.h> #include <stdlib.h> #include <string.h> void groupeetchoixgen(int*** choixGEN); void main(int args, char **argv) { int** choixGEN; int i,j; choixGEN=(int**) malloc (sizeof(int*)*2); for (i=0; i<3; i++) { choixGEN[i]=(int*) malloc (sizeof(int)*3); } groupeetchoixgen(&choixGEN); } void groupeetchoixgen(int*** choixGEN) { (*(choixGEN)[1])[0]=1; } I Think that the trouble is (*(choixGEN)[1])[0]=1; But I don't know why !
Thanks for your help
(*choixGEN)[1][0] = 1;?