Je reçois une erreur de segmentation pour une raison quelconque. Je ne sais pas pourquoi. De l'aide?Erreur de segmentation inexplicable
typedef struct gw_struct{
int pop;
int col;
int row;
struct district ***gw;
struct person **people;
};
typedef struct gw_struct *GW;
, puis plus tard dans une fonction ...
GW world;
struct district ***array = malloc(nrows*sizeof(struct district**));
int i, j;
for (i = 0; i < nrows; i++)
{
array[i] = malloc(ncols*sizeof(struct district*));
for (j = 0; j<ncols; j++)
{
array[i][j] = malloc(sizeof(struct district));
}
}
world->gw = array; //this is the line that gives the seg fault
avez-vous intialisé le monde du pointeur ???? – 999k