Find repeated Node on a custom LinkedList provokes Segmentation fault by recursion

findRepeated function crash on the line where the recursion is call:


Because you don’t check if the value of node is NULL. So when you come to the last node you call the function findRepeated with node->next where next is null. To fix this you just have to check it like:

if (node->next != NULL) {

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top