The program creates a hashtable from a csv. The function works only for the first piece of data, when I try to link a new node (linked chaining) it fails to attach a new node. I tried to read if there was a node present, and if there was to traverse until it found the end and then insert the node 'event' into the linked list.
Any help is appreciated.
struct hash_table_entry{
    int event_id;
    int year;
    int event_index;
    struct hash_table_entry *next = nullptr;
};
This is the function
bool insertHash(int index, hash_table_entry *event)
{
    if(hashtable[index] == nullptr)
    {
        hashtable[index] = event;
        return true;
    }
    hash_table_entry *pointingAt, *head;
    // before we move
    pointingAt = hashtable[index];
    head = hashtable[index];
    while(pointingAt->next)
    {
        pointingAt = pointingAt->next;
    }
    // insert
    cout <<  pointingAt << "<- thing inserted" << endl;
    pointingAt->next = event;
    return true;
}
This is how I implemented it in main (runs for each line in the csv)
insertHash(hashCalc(EVENT_ID,&c)
// c is the event
