-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstsize.c
34 lines (30 loc) · 1.25 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lspohle <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/21 12:57:55 by lspohle #+# #+# */
/* Updated: 2022/12/29 18:57:54 by lspohle ### ########.fr */
/* */
/* ************************************************************************** */
// Note
// Prototyped as int ft_lstsize(t_list *lst)
// -> lst: the beginning of the list
// -> counts the number of nodes in a list
// -> external functs: none
// -> return: the length of the list
#include "libft.h"
// Counts the number of nodes in a list
int ft_lstsize(t_list *lst)
{
int len;
len = 0;
while (lst != NULL)
{
lst = lst->next;
len++;
}
return (len);
}