Initially you have declared `node *table[N]` as ***global pointer***. As you might have already guessed, all global variables/ pointers are set to default values.(In this case, each pointer is set to NULL). So `head = table[hash_index]; // It's still NULL` When you do `head->next`, you're trying to de-reference NULL which results in seg-fault.