So I'm new to linked lists and I keep getting a segmentation fault error. Can anyone spot my error in my insertion and deletion methods? Any explanation would be so appreciated.
Notes:
My constructor for the list creates a head node and makes its pointer point to NULL.
My carX.compare(carY) function determines which car is "better", and returns -1 if car x is "lesser"
quality, returns 0 if they have the same info, or returns 1 if carX is "better" than carY
On line 10, you try to access head->next even though your if statement is designed to execute that code only when head is nullptr. You want to assign to head instead.