diff --git a/ex00/ft_strdup.c b/ex00/ft_strdup.c index 7bb0fdf..7095da2 100644 --- a/ex00/ft_strdup.c +++ b/ex00/ft_strdup.c @@ -37,7 +37,7 @@ char *ft_strdup(char *src) { char *new_str; - new_str = malloc(8 * ft_strlen(src)); + new_str = malloc(sizeof(char *) * ft_strlen(src)); ft_strcpy(new_str, src); return (new_str); } diff --git a/ex01/ft_range.c b/ex01/ft_range.c index d13f43d..7541273 100644 --- a/ex01/ft_range.c +++ b/ex01/ft_range.c @@ -18,7 +18,7 @@ int *ft_range(int min, int max) int idx; if (min >= max) - return ((void *) 0); + return (NULL); range = malloc(sizeof(int) * (max - min)); idx = -1; while (++idx < max - min) diff --git a/ex02/ft_ultimate_range.c b/ex02/ft_ultimate_range.c index 3f022d1..2ebb672 100644 --- a/ex02/ft_ultimate_range.c +++ b/ex02/ft_ultimate_range.c @@ -19,7 +19,7 @@ int ft_ultimate_range(int **range, int min, int max) if (min >= max) { - *range = (void *) 0; + *range = NULL; return (-1); } *range = malloc(sizeof(int) * (max - min)); diff --git a/ex03/ft_strjoin.c b/ex03/ft_strjoin.c index a61fd98..fae170b 100644 --- a/ex03/ft_strjoin.c +++ b/ex03/ft_strjoin.c @@ -77,7 +77,7 @@ int main(void) size = 5; // sep = ""; sep = ""; - strs = malloc(sizeof((char *) 0) * size); + strs = malloc(sizeof(char*) * size); strs[0] = "First"; strs[1] = "Second"; strs[2] = "Third"; diff --git a/ex04/ft_convert_base.c b/ex04/ft_convert_base.c index dd30864..fae2127 100644 --- a/ex04/ft_convert_base.c +++ b/ex04/ft_convert_base.c @@ -60,7 +60,7 @@ char *ft_to_base(int nbr, char *base_to) base_len = is_valid_base(base_to, 1); if (!base_len) - return ((void *) 0); + return (NULL); result = malloc(sizeof(char) * MAX_OUTPUT_LEN); idx = -1; while (++idx < MAX_OUTPUT_LEN)