-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstadd_front.c
25 lines (22 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gcosta-d <gcosta-d@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/09/08 20:28:16 by gcosta-d #+# #+# */
/* Updated: 2021/09/14 10:02:26 by gcosta-d ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/* List add front will add new elements to the front of the list
* We need to change the next of the new element to keeps the address
* of the pointer that point to the head of the list. Then the pointer
* keeps the address of the new element.
*/
void ft_lstadd_front(t_list **lst, t_list *new)
{
new->next = *lst;
*lst = new;
}