42_C_PISCINE/C/c07v2/ex02/ft_ultimate_range.c
Camille Chauvet 29ed24d567 init
2023-05-17 16:45:25 +00:00

31 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ultimate_range.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/22 10:33:24 by cchauvet #+# #+# */
/* Updated: 2022/08/01 14:36:41 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int ft_ultimate_range(int **range, int min, int max)
{
int i;
*range = NULL;
if (max <= min)
return (0);
*range = malloc(sizeof(*range) * (max - min));
i = 0;
while (min + i < max)
{
(*range)[i] = min + i;
i++;
}
return (max - min);
}