42_C_PISCINE/C/c07v1/ex01/ft_range.c
Camille Chauvet 29ed24d567 init
2023-05-17 16:45:25 +00:00

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);
}