-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstsize_bonus.c
More file actions
41 lines (36 loc) · 1.25 KB
/
ft_lstsize_bonus.c
File metadata and controls
41 lines (36 loc) · 1.25 KB
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
35
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lcosta-g <lcosta-g@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/09 13:18:41 by lcosta-g #+# #+# */
/* Updated: 2024/10/29 15:06:49 by lcosta-g ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int len;
len = 0;
while (lst)
{
len++;
lst = lst->next;
}
return (len);
}
/*
#include <stdio.h>
int main(void)
{
t_list *lst;
t_list *node;
lst = ft_lstnew("ft_lstsize example 1");
node = ft_lstnew("ft_lstsize example 2");
ft_lstadd_front(&lst, node);
printf("List len: %i\n", ft_lstsize(lst));
return (0);
}
*/