-
Notifications
You must be signed in to change notification settings - Fork 2
/
ft_lstsize.c
37 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cado-car <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/31 11:57:11 by cado-car #+# #+# */
/* Updated: 2021/07/31 12:01:07 by cado-car ### ########lyon.fr */
/* */
/* ************************************************************************** */
/*
* DESCRIPTION
* Counts the number of elements in a list.
* PARAMETERS
* #1. The beginning of the list.
* RETURN VALUES
* Length of the list.
*/
#include "libft.h"
int ft_lstsize(t_list *lst)
{
t_list *temp;
int count;
temp = lst;
count = 0;
while (temp != NULL)
{
count++;
temp = temp->next;
}
return (count);
}