-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathft_range.c
32 lines (29 loc) · 1.12 KB
/
ft_range.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_range.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vbrazas <vbrazas@student.unit.ua> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/10/25 19:39:27 by vbrazas #+# #+# */
/* Updated: 2017/11/12 20:24:48 by vbrazas ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int *ft_range(int min, int max)
{
int i;
int *p;
if (min >= max)
return (0);
p = (int *)malloc(sizeof(int) * (max - min));
if (p == NULL)
return (NULL);
i = -1;
while (min < max)
{
p[++i] = min;
min++;
}
return (p);
}