-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstsize_bonus.c
More file actions
32 lines (28 loc) · 1.11 KB
/
ft_lstsize_bonus.c
File metadata and controls
32 lines (28 loc) · 1.11 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kmoutaou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/19 20:09:01 by kmoutaou #+# #+# */
/* Updated: 2021/11/19 20:09:04 by kmoutaou ### ########.fr */
/* */
/* ************************************************************************** */
/*
ft_lstsize is a function that counts the number of elements in a list.
*/
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int i;
t_list *lst0;
i = 0;
lst0 = lst;
while (lst0 != NULL)
{
lst0 = lst0 -> next;
i++;
}
return (i);
}