for(int i = 0; i < agentArrCt; i++){
delete temp;
}
here you are deleting temp several times so it’s going to crash, also it’s usually easier to use vectors since they auto delete once the function ends:
for(int i = 0; i < agentArrCt; i++){
delete temp;
}
when what was actually in the code (and still failed):
for(int i = 0; i < agentArrCt; i++){
delete temp[i];
}
temp is a pointer to an array of pointers, so each pointer which temp points to needs to be deleted individually. At least thats how it’s supposed to go.
and i know i can use vectors but i started with manual dynamic arrays and now i’m too deep in it to switch.