1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
2023-08-03 23:16:27 +02:00

71 lines
1.5 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lib2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ttrave <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/30 16:46:55 by ttrave #+# #+# */
/* Updated: 2023/07/30 20:41:52 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include "header.h"
void ft_free_n_arr_arr(char **arr, t_ulli n)
{
t_ulli i;
i = 0;
while (i < n)
{
free(arr[i]);
i++;
}
free(arr);
}
void ft_free_arr_arr(char **arr)
{
t_ulli i;
i = 0;
while (arr[i])
{
free(arr[i]);
i++;
}
free(arr);
}
int ft_number_is_printable(char *number, char **dict)
{
t_ulli i;
t_ulli len;
len = 0;
i = 0;
while (dict[i])
{
if (len < ft_strlen(dict[i]))
len = ft_strlen(dict[i]);
i += 2;
}
if (ft_strlen(number) > len + 2)
return (0);
return (1);
}
char *ft_cat(char ten, char unit)
{
char *res;
res = malloc(3 * sizeof(int));
if (!res)
return (0);
res[0] = ten;
res[1] = unit;
res[2] = 0;
return (res);
}