Hi, I'm trying to do a hashing project using separate chaining. In order to do the separate chaining I believe I need to make a dynamic array of pointers to the linked lists. This is due to the fact the user can specify the hash table size at runtime. In VS2010 when I try to set the HEAD pointer values to NULL it won't compile and returns "no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)".
My code is super simple so I'm not sure what I am doing wrong. Any help would be great. Thx, Glenn.
struct list
{
list *next;
list *prev;
int numValue;
};
void separateChaining(int hashTable[], int hashTableSize)
{
list * listArray;
listArray = new list[hashTableSize];
if(listArray == NULL)
{
cout << endl << "Memory error creating array of linked lists!";
system("PAUSE");
return;
}
for(int i = 0; i < hashTableSize; i++)
{
listArray[i] = NULL;
}
}