/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_map.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gtertysh +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/07 16:54:39 by gtertysh #+# #+# */ /* Updated: 2016/11/07 17:25:19 by gtertysh ### ########.fr */ /* */ /* ************************************************************************** */ #include int *ft_map(int *tab, int length, int (*f)(int)) { int *arr; int i; i = 0; arr = (int *)malloc(sizeof(int) * (length)); while (i < length) { arr[i] = f(tab[i]); i++; } return (arr); }