Delete node given single pointer to that node

PHOTO EMBED

Wed Jun 08 2022 20:54:15 GMT+0000 (Coordinated Universal Time)

Saved by @Ranjan_kumar #c++

void deleteNode(Node *ptr)
{
 //creating temporary pointer
 Node *temp;
  //Pointing temp to link part of current node i.e. next node
 temp=ptr->next;
 //copy data and link part of next node to current node
 ptr->data=temp->data;
 //point current node to link part of next node
 ptr->next=temp->next;
 //Delete current node
 free(temp);

}
content_copyCOPY