Where am i going wrong in this doubly linked list code?

add this condition in your code

 if(head==NULL){
        head=n;
        return;
    }

Modified Code

if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like :heart:: and don’t forgot to mark doubt as resolved :grinning:

1 Like

Doubt resolved. Thank you