32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_range.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2022/07/21 18:54:20 by cchauvet #+# #+# */
|
||
|
/* Updated: 2022/07/26 17:57:51 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int *ft_range(int min, int max)
|
||
|
{
|
||
|
int i;
|
||
|
int *tab;
|
||
|
|
||
|
*tab = NULL;
|
||
|
if (max <= min)
|
||
|
return (tab);
|
||
|
tab = malloc(sizeof(*tab) * (max - min));
|
||
|
i = 0;
|
||
|
while (min + i < max)
|
||
|
{
|
||
|
*(tab + i) = min + i;
|
||
|
i++;
|
||
|
}
|
||
|
return (tab);
|
||
|
}
|