31 lines
1.1 KiB
C
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/07/26 17:50:02 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);
|
||
|
}
|