0

Hello. I'm a newbie and i was wondering if anyone can tell me how to create an array that contains objects and number 0 wherever there is no object. Thanks in advance

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by __avd
0

I think you might be talking about an array of pointers to some objects, and the pointers are NULL if it does not contain valid pointer. Something like this:

class MyClass
{
   // blabla
};

// an array of 10 pointers to MyClass objects, 
// initialized to NULL pointers.
MyClass* array[10] = {NULL};
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.