1st Sep 2022, 12:01 PM
Shweta Yadav
2 Respostas
+ 1
free(head) deletes next link. Try this way : void del_first(struct node*head){ if(head==NULL){ printf("list is already empty"); } else { struct node* n = head; n->data = n->link->data; n->link = n->link->link; head = n; n = NULL; } } Hope it helps...
1st Sep 2022, 1:02 PM
Jayakrishna 🇮🇳
+ 1
Thank you it works 🙂
1st Sep 2022, 4:02 PM
Shweta Yadav