maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_realloc_array.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_realloc_array.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: rocky <marvin@42.fr> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2024/09/26 19:19:46 by rocky #+# #+# */
9
/* Updated: 2024/09/26 19:19:50 by rocky ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "
libft.h
"
14
15
char
**
ft_realloc_array
(
char
**array,
int
old_size,
int
new_size)
16
{
17
char
**new_array;
18
int
i;
19
20
new_array = malloc(
sizeof
(
char
*) * (new_size + 1));
21
if
(!new_array)
22
exit(1);
23
i = 0;
24
while
(i < old_size)
25
{
26
new_array[i] = array[i];
27
i++;
28
}
29
while
(i < new_size)
30
{
31
new_array[i] = NULL;
32
i++;
33
}
34
free(array);
35
return
(new_array);
36
}
ft_realloc_array
char ** ft_realloc_array(char **array, int old_size, int new_size)
Definition
ft_realloc_array.c:15
libft.h
lib
libft
src
ft_realloc_array.c
Generated by
1.9.8