Runtime error happens when deleting a node of the linklist [closed]

Your deleteNode() function does not check whether c and a are non-NULL, but immediately dereferences them. This means that your program will crash if you try to delete the first or last node of the list.

Your insertAfter() function also sets pointers in the wrong order, causing nNode->prev to point to itself.

Leave a Comment