/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_map.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/08/12 13:24:15 by jhalford #+# #+# */ /* Updated: 2016/08/12 13:24:38 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include int *ft_map(int *tab, int length, int (*f)(int)) { int i; int *new_tab; i = 0; new_tab = malloc(sizeof(int) * (length + 1)); while (i < length) { new_tab[i] = f(tab[i]); i++; } return (new_tab); }