void deletetail(node*(&head))
{
node *prev=head;
while(prev->next!=NULL)
{
head=prev;
prev=prev->next;
}
head->next=prev->next;
}
In deleting the node from end,what is wrong in this function as it is not giving the desired output
void deletetail(node*(&head))
{
node *prev=head;
while(prev->next!=NULL)
{
head=prev;
prev=prev->next;
}
head->next=prev->next;
}
In deleting the node from end,what is wrong in this function as it is not giving the desired output
hello @shubhangis248
ur r passing reference of head node in this function,
and in this function u are modfying it (the head node) which we dont want.
so create another pointer and store head in that pointer and then update that pointer instead of head pointer