dl_insert()
#
Inserts an item at the head of a doubly linked list dl
.
Prototype
int dl_insert(
dl_list_t *dl,
void *item
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Pointer to the doubly linked list where the item will be inserted. |
|
|
Pointer to the item to be inserted at the head of the list. |
Return Value
Returns 0 on success, or -1 if the item already has links and cannot be inserted.
Notes
The function checks if the item already has links before inserting it. If the list is empty, the item becomes both the head and tail.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples