-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstsize.c
36 lines (34 loc) · 1.33 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
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jamendoe <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/13 13:26:11 by jamendoe #+# #+# */
/* Updated: 2022/11/13 13:26:12 by jamendoe ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int i;
if (!lst)
return (0);
i = 0;
while (lst != NULL)
{
lst = lst->next;
i++;
}
return (i);
}
/*
Function name ft_lstsize
Prototype int ft_lstsize(t_list *lst);
Turn in files -
Parameters lst: The beginning of the list.
Return value The length of the list
External functs. None
Description Counts the number of nodes in a list.
*/