-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_range.c
More file actions
34 lines (31 loc) · 1.24 KB
/
ft_range.c
File metadata and controls
34 lines (31 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_range.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: rcabotia <marvin@le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/10/10 12:05:47 by rcabotia #+# ## ## #+# */
/* Updated: 2018/10/10 12:06:47 by rcabotia ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
int *ft_range(int min, int max)
{
int i;
int length;
int *array;
if (min >= max)
return (0);
i = 0;
length = max - min;
if (!(array = (int*)malloc(sizeof(*array) * length)))
return (NULL);
while (i < length)
{
array[i] = min + i;
i++;
}
return (array);
}