-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstsize.c
executable file
·39 lines (33 loc) · 1.19 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
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jchoy-me <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/19 15:51:25 by jchoy-me #+# #+# */
/* Updated: 2023/07/20 13:11:48 by jchoy-me ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
DESCRIPTION:
Counts the number of nodes in a list.
PARAMETERS:
lst: The beginning of the list.
RETURN VALUE:
The length of the list.
*/
int ft_lstsize(t_list *lst)
{
int size;
if (lst == NULL)
return (0);
size = 0;
while (lst != NULL)
{
lst = lst->next;
size++;
}
return (size);
}