I was reading the tcp/ip illustrated v2 and confused with a series of codes on the book.
struct ifnet{
struct ifnet * if_next;
……
}
here is the background information of the structure which may help you learn more about the problem
void if_attach(struct ifnet* ifp){
struct ifnet **p = &ifnet;
while(*p):
p = &((*p)->if_next);
*p = ifp;
why the author used a pointer to pointer in this place ? I promise that in the remaining text the p never appear again(which means it is never used as an argument of any function at all).
In my opinion this code can be converted to this
struct ifnet *p = ifnet;
while(p):
p = *p->if_next;
p = ifp;
Is that right?