S
suman kar
Hi all,
Please clarify the following piece of code:
<CODE>
/* delete node containing i from list pointed to by lp */
struct list *lp, *prevlp;
for(lp = list; lp != NULL; lp = lp->next)
{
if(lp->item == i)
{
if(lp == list) //Confusion!!
list = lp->next;
else prevlp->next = lp->next;
break;
}
prevlp = lp;
}
}
</CODE>
found at http://www.eskimo.com/~scs/cclass/int/sx8.html
I have a confusion as to what is meant by `list' in the `if' statement.
That appears to me to be a typo...
Regards
Suman
Please clarify the following piece of code:
<CODE>
/* delete node containing i from list pointed to by lp */
struct list *lp, *prevlp;
for(lp = list; lp != NULL; lp = lp->next)
{
if(lp->item == i)
{
if(lp == list) //Confusion!!
list = lp->next;
else prevlp->next = lp->next;
break;
}
prevlp = lp;
}
}
</CODE>
found at http://www.eskimo.com/~scs/cclass/int/sx8.html
I have a confusion as to what is meant by `list' in the `if' statement.
That appears to me to be a typo...
Regards
Suman