data_structures
Functions
list_peek.c File Reference
#include "list.h"
+ Include dependency graph for list_peek.c:

Go to the source code of this file.

Functions

void * list_peek (const t_list *alst, size_t index)
 Returns the item at the specified position in the list. More...
 

Function Documentation

◆ list_peek()

void* list_peek ( const t_list alst,
size_t  index 
)

Returns the item at the specified position in the list.

The item is kept in the list.

Returns
The item, or NULL if the list is empty.
Note
This method has complexity O(N/2) in the number of items in the worst case.

Definition at line 16 of file list_peek.c.