31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* 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);
|
||
|
}
|