Cub3D/libft/list/ft_lstadd_front.c
2024-10-31 18:17:43 +01:00

30 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/12 11:40:16 by rparodi #+# #+# */
/* Updated: 2024/10/31 17:30:01 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Add the list new to the front of chained list of lst
*
* @param lst first element of the list
* @param new The element to add at the start
*/
void ft_lstadd_front(t_list **lst, t_list *new)
{
if (*lst == NULL)
{
*lst = new;
return ;
}
new->next = *lst;
*lst = new;
}