1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
42-2nd-piscine/C07/ex01/ft_range.c

34 lines
1.1 KiB
C
Raw Normal View History

2023-08-03 23:16:27 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_range.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/27 19:51:50 by adjoly #+# #+# */
/* Updated: 2023/07/31 09:40:55 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int *ft_range(int min, int max)
{
int i;
int *arr;
i = 0;
if (min >= max)
return (NULL);
arr = malloc((max - min) * sizeof(int));
if (arr == NULL)
return (NULL);
while (min < max)
{
arr[i] = min;
min++;
i++;
}
return (arr);
}