GetNodePosFromHead()
function:
int32 GetNodePosFromHead( const List *l, const Node *n );
l
argument is a pointer to the list in which the node is located; the n
argument is the node to find in the list. The function scans the list looking for the node, and returns the position of the node within the list. The first node in the list has position 0. If the node cannot be located in the list, the function returns -1.
To determine the position of a node relative to the end of a list, use the GetNodePosFromTail()
function:
int32 GetNodePosFromTail( const List *l, const Node *n );
l
argument is a pointer to the list in which the node is located; the n
argument is the node to find in the list. The function scans the list looking for the node, and returns the position of the node relative to the end of the list. The last node in the list has position 0. If the node cannot be located in the list, the function returns -1.