-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstadd_front_bonus.c
31 lines (29 loc) · 1.36 KB
/
ft_lstadd_front_bonus.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: flverge <flverge@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/02 15:19:05 by flverge #+# #+# */
/* Updated: 2024/09/22 17:21:49 by flverge ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Adds a new element at the beginning of the list.
*
* This function takes a pointer to the first element
* of a list and a new element,
* and inserts the new element at the beginning of the list.
*
* @param lst A double pointer to the first element of the list.
* @param new A pointer to the new element to be added to the list.
*/
void ft_lstadd_front(t_list **lst, t_list *new)
{
if (lst == NULL || new == NULL)
return ;
new->next = *lst;
*lst = new;
}