libft/list/ft_lstsize.c
Raphael 905ffd4b72
refactor: only the usefull header
- Removing all 'libft.h' mention
- Using the include only on the files needed by
2025-09-01 18:45:33 +02:00

33 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/12 11:44:24 by rparodi #+# #+# */
/* Updated: 2025/09/01 16:39:28 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "list.h"
#include <unistd.h>
/**
* @brief Give the size of the chained list
*
* @param lst the chained list
* @return the size of the list
*/
int ft_lstsize(t_list *lst)
{
int count;
count = 0;
while (lst != NULL)
{
lst = lst->next;
count++;
}
return (count);
}