Can you fix my code?

Hey @akash_281
Did 2 changes in this function and mentioned the changes in comments

void insertAtTail(int d,node*&head,node*&prev)
{
    if(head==NULL )
    {
        head=new node(d);
        return;
    }
    node*tail=head;
    while(tail->next!=NULL) //updated here tail->next instead of head->next
    {
        tail=tail->next;
        //tail->prev
        // return;//removed return form here 
    }
    node*n=new node(d);
    tail->next=n;
    n->prev=tail;
    tail=n;
}

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