init
This commit is contained in:
30
C/c07/ex02/ft_ultimate_range.c
Normal file
30
C/c07/ex02/ft_ultimate_range.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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);
|
||||
}
|
Reference in New Issue
Block a user