The following code snippet is from:
http://www.eskimo.com/~scs/cclass/int/sx8.html
The code deletes a node from a linked list:
Code:struct list **lpp; for(lpp = &list; *lpp != NULL; lpp = &(*lpp)->next) { if((*lpp)->item == i) { *lpp = (*lpp)->next; break; } } }
The part of the construction I don't really understand is
Can someone break this part piece by piece? Like explain why the & operator is necessary. Why we just can't do something likeCode:lpp = &(*lpp)->next
lpp->next, etc.
Thanks
Chad



LinkBack URL
About LinkBacks



It's like math. Once you grasp arithmetic they throw algebra at you, and once you finally get algebra, you get smacked in the head with calculus. The more you learn, the more you're expected to be able to handle, and pointers are no different.