-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstadd_front.c
executable file
·30 lines (26 loc) · 1.22 KB
/
ft_lstadd_front.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jchoy-me <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/19 11:34:44 by jchoy-me #+# #+# */
/* Updated: 2023/07/20 13:00:16 by jchoy-me ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
DESCRIPTION:
Adds the node ’new’ at the beginning of the list.
PARAMETERS:
lst: The address of a pointer to the first link of a list.
new: The address of a pointer to the node 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;
}