I have this function:
void TraverseRecursive ( Node * head, void (*visit) (Node *) )
{
if ( head != nullptr )
{
visit( head ) ;
TraverseRecursive( head->next, visit ) ;
}
}
And I'm trying to call it in main.cpp with
TraverseRecursive ( head, TraverseRecursive ) ;
Which gives me the error "argument of type "void (*)(Node *head, void (*visit)(Node ))" is incompatible with parameter of type "void ()(Node *)" "
So how do I correctly call it? I am just learning linked lists and obviously don't understand what
void (*visit) (Node *)
means at all.