So i have an array of pointers that point to objects, and a pointer that points to each object elsewhere in my code. What i want is when i delete those other pointer. How do i rearrange my array of pointers so that there's no garbage values in the middle of it. I have a rearrange function that checks for NULL but the pointer doesn't point to NULL.
void Floor::rearrange(){
for (int i=0;i<numEnemies;i++){
if(Enemies[i] == NULL){
Enemies[i] = Enemies[i+1];
Enemies[i+1] = NULL;
}
}
}