My code does not return entire linked list

in the output only first node is displayed and the code is also working incorrectly.
below is the link to my code please help me correct it

Hey @prerna_gupta31

    bool p=false; //correction 1 :initialize

Also

while(fast!=NULL && fast->next!=NULL)
    {
        slow = slow->next; //do this before because otherwise they are already equal to head
        fast = fast->next->next;
        if(slow==fast)
        {
            p = true;
            break;
        }
        // slow = slow->next;
        // fast = fast->next->next;
    } 

If this resolves your query then please mark it as resolved :slight_smile: