-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstsize_bonus.c
28 lines (24 loc) · 1.14 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dolvin17 <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/03 17:23:58 by ghuertas #+# #+# */
/* Updated: 2022/04/25 11:01:40 by dolvin17 ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/* cuenta los elementos de una lista */
int ft_lstsize(t_list *list)
{
int i;
i = 0;
while (list != NULL)//meintras lst distinto de null
{
list = list->next;
i++;//recorro la lista hasta llegar a null.
}
return (i);//retorno mi contador.
}