ft_lstadd_front - gabrielcoelhodacunha-old/42sp-libft GitHub Wiki

Description

Adds the element new at the beginning of lst.

Implementation

void	ft_lstadd_front(t_list **lst, t_list *new)
{
	// Checks if `lst` has at least one element and if `new` is valid
	if (*lst && new)
		new->next = *lst;
	*lst = new;
}