-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_freestrs.c
41 lines (38 loc) · 1.26 KB
/
ft_freestrs.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free_strs.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mgraf <mgraf@student.42berlin.de> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/17 14:03:11 by mgraf #+# #+# */
/* Updated: 2023/05/03 15:46:32 by mgraf ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Frees strings
* @param *str String to free or NULL
* @param **str Array of strings to free or NULL
*/
void free_strs(char *str, char **strs)
{
int i;
if (str != NULL)
{
free(str);
str = NULL;
}
i = 0;
if (strs[i] != NULL)
{
while (strs[i] != NULL)
{
free(strs[i]);
strs[i] = NULL;
i++;
}
free(strs);
strs = NULL;
}
}