Even if we know that you are looking for is the i-th node, we can not reach directly, because the node is not stored in the order, we can only start from scratch pointers, one by one along the chain domain next node down the search until the search until ai.
//查找第i个节点
int FindElem(LinkList &L, int &e, int i)
{
LNode *p;
p = L->next; //p指向首节点
int j = 1; // j表示第几个节点
if (i < 1)
return 0;
while (p != NULL && j < i) //p后无节点了或者找到第i个节点
{
p = p->next;
j++;
}
if (p == NULL)
return 0;
e = p->date;
return 1;
}