Nov 12, 2016 at 2:16am UTC
Hello,
I was wondering if someone would please help me figure out why I am getting the following error message:
"Expression must be a modifiable lvalue"
I get this message at the following line of code:
hashtable = new nodeType*[arraySize];
This code is in the constructor for my hashtable class. Here is that code:
MyChain::MyChain()
{
arraySize = 100;
hashtable = new nodeType*[arraySize];
for (int i = 0; i < arraySize; i++)
{
hashtable[i]=nullptr;
}
}
Here is the code for that class:
struct nodeType
{
int info;
nodeType *link;
}
class MyChain
{
public:
void print() const;
void push (int val);
void deleteItem(int val);
MyChain();
private:
int arraySize;
nodeType *hashtable[100];
};
I understand that the message means that the value to the left of the = cannot be modified. I just don't understand why that's the case with that code segment.
Any guidance is appreciated.
Thanks!
Ragan