Fill a 2d array of pointers with pointers to structs in C
I'm not sure why you say cells[i][j]->value = 0;
doesn't work, I believe it should.
This should work to set all the members.
Cell ***cells = malloc(sizeof(Cell**) * size);
for(i = 0; i < size; i++){
cells[i] = malloc(sizeof(Cell*) * size);
for(j = 0; j < size; j++){
cells[i][j] = malloc(sizeof(Cell));
cells[i][j]->p.x = i;
cells[i][j]->p.y = j;
cells[i][j]->value = 0;
}
}