Next: , Previous: sll_head_node, Up: Singly Linked Lists


3.1.13 sll_insert

Create and insert a node into a singly linked list.

Synopsis

     #include <linklist/linklist.h>
     
     
     
int sll_insert( SLinkList ull, void *data );

Parameters

SLinkList ull
a handle to the list into which to insert the node
void *data
a pointer to the new node's data

Description

sll_insert creates a node, stores the passed data pointer in it, and inserts the node in the list in the collating order determined by the comparison function with which the list was initialized by sll_new.

Returns

It returns zero if the insert was successful, non-zero if it was unable to create the new node