[SOLVED] Segfault (pol1)
I'm getting a segfault with the following code:
int indx = enigma::room_idmax++;
newroomdata = new enigma::roomstruct*[indx + 1];
newroomdata[indx]->id = indx;
It's printing e but not f so it's segfaulting at newroomdata[indx]->id = indx;
Can anybody see anything I have done wrong with the pointers or array size? Thanks for any help.
roomstruct is declared like so:
Last edited on
Nevermind I solved it. I needed to use:
newroomdata[indx] = new enigma::roomstruct;
Topic archived. No new replies allowed.