findRepeated
function crash on the line where the recursion is call:
findRepeated(node->next);
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) {
findRepeated(node->next);
}
CLICK HERE to find out more related problems solutions.