int LengthList( Node *L )
{
Node *p = L->next; //将p初始指向链表中第一个节点的地址
int length = 0;
while(p) //当p指向的地址不为空时,继续循环计算长度
{
++length;
p = p->next; //链表长度加1后,将p指向其后继节点地址
}
return length;
}
int LengthList(Node *L)
{
int l=0;
Node *S=L;
while(!S)
{
l++;
S=S->next;
}
return l;
}
for()