-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstsize_bonus.c
42 lines (38 loc) · 1.39 KB
/
ft_lstsize_bonus.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
35
36
37
38
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anamartinez <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/22 18:45:02 by anamartinez #+# #+# */
/* Updated: 2023/05/05 13:51:54 by anamartinez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int counter;
t_list *aux;
counter = 0;
aux = lst;
while (aux != NULL)
{
counter++;
aux = aux->next;
}
return (counter);
}
// int main(void)
// {
// t_list *my_list;
// my_list = NULL;
// t_list *node_1 = ft_lstnew("Nodo 1");
// ft_lstadd_front(&my_list, node_1);
// t_list *node_2 = ft_lstnew("Nodo 2");
// my_list->next = node_2;
// t_list *node_3 = ft_lstnew("Nodo 3");
// node_2->next = node_3;
// printf("%i", ft_lstsize(my_list));
// return (0);
// }