-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_array_utils.c
42 lines (38 loc) · 1.29 KB
/
ft_array_utils.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
33
34
35
36
37
38
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_array_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: flfische <[email protected]. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/29 14:34:13 by flfische #+# #+# */
/* Updated: 2024/04/09 16:11:02 by flfische ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_push_swap.h"
void ft_free_str_array(char **array, int index)
{
while (array[index])
{
free(array[index]);
index++;
}
free(array);
}
int *ft_realloc_int(int *array, int *size)
{
int *new_array;
int i;
new_array = malloc(sizeof(int) * (*size * 2));
if (new_array == NULL)
return (NULL);
i = 0;
while (i < *size)
{
new_array[i] = array[i];
i++;
}
*size *= 2;
free(array);
return (new_array);
}