aboutsummaryrefslogtreecommitdiff
path: root/c12/ex01/ft_list_push_front.c
blob: 788fce1c2bc64245550994726aefea367871924b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_list_push_front.c                               :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <charles.cabergs@gmail.com>       +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2019/07/09 17:19:14 by cacharle          #+#    #+#             */
/*   Updated: 2019/07/09 17:19:15 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "ft_list.h"

void	ft_list_push_front(t_list **begin_list, void *data)
{
	t_list	new_front;

	new_front = (t_list*)malloc(sizeof(t_list));
	new_front->data = data;
	new_front->next = *begin_list;
	if (*begin_list)
		*begin_list = new_front;
}