I have this class and struct, and every struct on the array connected to another struct (linked list structure on every element of array).. btw this is just a sample of my code, assume there are no other errors..
class DATA;
class myclass
{
public:
myclass();
mystruct* addDATA(DATA *d);
private:
mystruct* array;
};
struct mystruct
{
DATA * data;
mystruct * next ;
};
In the constructor I am trying this
mystruct::mystruct()
{
mystruct* array = new mystruct[10];
for(int i = 0; i < 10; i++)
array[i] = NULL;
}
this gives an unexpected(at least to me) error, Isn't this error a bit ridiculous, I am making pointers to point to NULL.
no match for ‘operator=’ in ‘*(array + ((unsigned int)(((unsigned int)i) * 8u))) = 0’
And also when I try to;
while(this->array[i] != NULL){
// do some arrangements on the array..
}
This also gives the same error.. Why would matching a pointer to NULL give this error, or checking if its NULL or not..Struggling since this morning, couldn't find a **ing solution :/ Array's type is "mystruct" but nothing else, Is this a problem? Or array[i] is not a pointer or something?