So I've been trying to create a class that handles 1000 linked lists, and initially declares pointers to them.
This is the code that deals directly with my issues:
struct node
{
char name[40];
char numb[12];
node * next;
};
class hashTable
{
public:
//Creates a table of 1000 pointers to linked-list nodes
node * table[1000];
//Functions
void addNode(char name[40], char numb[12])
{
node * temp; //Initializes temp node as pointer
temp = new node; //Points temp node to a new node
int hash = h(g(name)); //The hash of the key (name) used to check nodes
temp = table[hash]; //sets the temporary node to the first node of the list
while (temp->next != 0)
{
//...
Right at the while loop is where I get the error "Access violation reading location 0xcccccd00" I'm not sure why it can't access the table member, unless perhaps it is because these values have not been initialized or anything?