Detect a invalid object point in object pointer array

 

Dear mql4.com users:

I want to know when an array position of a object pointer arrays han no pointer in int.

MyObject *Objects[3]

Imagine we have 4 objects inside this array

And the we delete Objects[2], and made a loop trying to find the position without pointer.

for(int i=0; i<4; i++)

   {if(Objects[i]==????) Alert("Object not found in position i");}


Can you help me find the ????

Thank you

 
BeLikeWater:
MyObject *Objects[3]

Imagine we have 4 objects inside this array

And the we delete Objects[2], and made a loop trying to find the position without pointer.

for(int i=0; i<4; i++)

   {if(Objects[i]==????) Alert("Object not found in position i");}
  1. Array Objects only has 3 elements, can't be "4 objects inside the array."
  2. Read the docs. Learn the available functions
    for(int i=0; i<4; i++){
       if(Objects[i] != NULL 
       && CheckPointer(Objects[i]) == POINTER_INVALID
       )  Alert("Object not found in position "+String(i));
    }

 

Thank you very much.

That was what I was looking for.

Greetings

Reason: