node_bn* NthNode_bn ( const nodelist_bn*  nodes,   int  index )

Returns the node at position index within list nodes.

The numbering starts with 0, and goes to LengthNodeList_bn (nodes) - 1.

If index is less than 0, or greater than LengthNodeList_bn (nodes) - 1, NULL will be returned, and an error will be generated (unless it is LAST_ENTRY, which indicates the last node).

To recover the node by name, rather than index, see the suggestion in GetNodeNamed_bn.

For the inverse function (finding the index given the node) see the function IndexOfNodeInList_bn.


This function is available in all versions.

See also:

IndexOfNodeInList_bn    (inverse function) Return the index, given the node
SetNthNode_bn    Set the node at the given index
RemoveNthNode_bn    Remove the node from the list (also returns it)
LengthNodeList_bn    Find maximum node index


The following function is available in NeticaEx.c:
// Prints out the names of the nodes in the list passed to it. // You may need to print a newline ('\n') before the writing appears. // #include <stdio.h> void PrintNodeList (nodelist_bn* nodes){ int i, numnodes = LengthNodeList_bn (nodes); for (i = 0; i < numnodes; ++i){ if (i != 0) printf (", "); printf ("%s", GetNodeName_bn (NthNode_bn (nodes, i))); } }