segmentation fault in an sorted linked list program for Homework [closed]

In the constructor, you set root to Null.

Then in insertNode, you do:

cursor = root;
while(cursor->getNextNode())

You need to allocate a root node, or deal with it being Null.

Leave a Comment