42/d07/ex01/ft_range.c

31 lines
1.1 KiB
C
Raw Normal View History

2016-11-20 02:20:23 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_range.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 10:45:07 by gtertysh #+# #+# */
/* Updated: 2016/11/03 18:58:22 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int *ft_range(int min, int max)
{
int *array;
int i;
if (min >= max)
return (0);
array = (int*)malloc(sizeof(int*) * (max - min));
i = 0;
while (i < max - min)
{
array[i] = min + i;
i++;
}
return (array);
}