-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstsize.c
34 lines (28 loc) · 1.2 KB
/
ft_lstsize.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: amait-ou <amait-ou@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/05 08:59:03 by amait-ou #+# #+# */
/* Updated: 2023/06/27 18:16:04 by amait-ou ### ########.fr */
/* */
/* ************************************************************************** */
/*
This is a linked list, so if you want to count the size of this linked
list, you have to achieve the last node which is "NULL" and increment
the counter by one in each move to the next
*/
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int i;
i = 0;
while (lst != (void *)0)
{
++i;
lst = lst->next;
}
return (i);
}