Libft
42 Libft library documentation
Loading...
Searching...
No Matches
ft_lstiter.c File Reference
+ Include dependency graph for ft_lstiter.c:

Go to the source code of this file.

Functions

void ft_lstiter (t_list *lst, void(*f)(void *))
 Iterates over a linked list and applies a function to each element. This function takes a linked list and a function pointer, then applies the function to the content of each element in the list.
 

Function Documentation

◆ ft_lstiter()

void ft_lstiter ( t_list lst,
void(*)(void *)  f 
)

Iterates over a linked list and applies a function to each element. This function takes a linked list and a function pointer, then applies the function to the content of each element in the list.

Parameters
lstThe linked list to iterate over.
fThe function to apply to each element.

Definition at line 23 of file ft_lstiter.c.

24{
25 if (!lst || !f)
26 return ;
27 while (lst)
28 {
29 f(lst->content);
30 lst = lst->next;
31 }
32}
struct s_list * next
Definition types.h:6
void * content
Definition types.h:5

References s_list::content, and s_list::next.