What's wrong with this code. I know its a runtime error but, well the output is null when i use my own test case too. why is it showing null


#1

listnode* deleteDuplicates(listnode* head)
{
if(head== NULL)return head;
listnode *temp = head;
listnode *curr = head;

   while(curr!=NULL )
{

    while(temp && temp->val == temp->next->val)
    {
        temp=temp->next;
    }
    temp= temp->next;
    curr->next=temp;
    curr = temp;*/
}

return head;

}