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

Go to the source code of this file.

Functions

int ft_lstsize (t_list *lst)
 Counts the number of nodes in a linked list.
 

Function Documentation

◆ ft_lstsize()

int ft_lstsize ( t_list lst)

Counts the number of nodes in a linked list.

Parameters
lstHead of the list.
Returns
Number of nodes.

Definition at line 21 of file ft_lstsize.c.

22{
23 int count;
24
25 count = 0;
26 while (lst)
27 {
28 lst = lst->next;
29 count++;
30 }
31 return (count);
32}
struct s_list * next
Definition types.h:6

References s_list::next.