init
This commit is contained in:
31
Correction/cc/ex01/ft_range.c
Normal file
31
Correction/cc/ex01/ft_range.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_range.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/21 18:54:20 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/08/01 14:36:12 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int *ft_range(int min, int max)
|
||||
{
|
||||
int i;
|
||||
int *tab;
|
||||
|
||||
tab = NULL;
|
||||
if (max <= min)
|
||||
return (tab);
|
||||
tab = malloc(sizeof(*tab) * (max - min));
|
||||
i = 0;
|
||||
while (min + i < max)
|
||||
{
|
||||
*(tab + i) = min + i;
|
||||
i++;
|
||||
}
|
||||
return (tab);
|
||||
}
|
Reference in New Issue
Block a user