I am using the following code on a linked list of characters. But whenever I run this program, I get a runtime error.

```
void ldellist(Node *head,char k) 
{
    Node *remove=head;
    Node *previous=head;
    while(remove->data!=k) 
    {
        remove=remove->next; 
    }
    while(previous->next!=remove) 
    {
        previous=previous->next; 
    }
    previous->next=remove->next;
    free(remove);
} 

```

Could someone tell me what's the problem?