Accessing Pointers to Nodes in a Linked List

To get the pointer to the first node in a linked list, call nd_first():

NODEPTR nd_first(hdndp)

NODEPTR hdndp;        /* Pointer to header node of linked list        */

To get the pointer to the last node in a linked list, call nd_last():

NODEPTR nd_last(hdndp)

NODEPTR hdndp;        /* Pointer to header node of linked list        */

Given a pointer to a node in a linked list, you can get the pointer to the next node by calling nd_next():

NODEPTR nd_next(ndp)

NODEPTR ndp;        /* Pointer to node in linked list            */

Given a pointer to a node in a linked list, you can get the pointer to the previous node by calling nd_prev():

NODEPTR nd_prev(ndp)

NODEPTR ndp;        /* Pointer to node in linked list            */

You can find the number of the node within the linked list by calling nd_ptrnum():

int nd_ptrnum(ndp, hdndp)
 
NODEPTR ndp;
/* Pointer to node in linked list
*/
NODEPTR hdndp;
/* Pointer to header node of linked list
*/

You can convert a node number in a linked list to a pointer to that node by calling nd_numptr():

NODEPTR nd_numptr(nd_num, hdndp)
 
int nd_num;
/* Number of node
*/
NODEPTR hdndp;
/* Pointer to header node of linked list
*/


Home Contents Previous Next