#include <stdlib.h>
#include <stdio.h>
int ft_ultimate_range(int **range, int min, int max)
{
int i;
int *result;
if (min >= max)
{
*range = NULL;
return (0);
}
i = max - min;
result = malloc(sizeof(int) * (i));
if (result == NULL)
{
*range = NULL;
return (-1);
}
*range = result;
i = 0;
while (max > min)
{
result[i] = min;
min++;
i++;
}
return (i);
}
int main(void)
{
int min;
int max;
int *tab;
int size;
int i;
i = 0;
min = 5;
max = 10;
size = ft_ultimate_range(&tab, min, max);
while(i < size)
{
printf("%d, ", tab[i]);
i++;
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: