Can anyone tell me about this program how the delete tail work ?
.....................................................................
void linklist::deleteSearchList(int id)
{
node * cur;
cur = head;
if (cur == NULL)
return; // no node in list
if (cur->link == NULL){
delete cur;
head = NULL;
}else if (id == head ->st.id){
cur = head;
head = head->link;
delete cur;
}else {
node * p;
p = head;
do{
if( cur->st.id==id )
break;
p = cur;
cur = cur -> link;
}
while (cur !=NULL);
p->link = cur->link;
delete cur;
}
}