Something went wrong. Try again.
My solution for the ft_printf assignment.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940/* ************************************************************************** *//* *//* ::: :::::::: *//* ft_calloc.c :+: :+: :+: *//* +:+ +:+ +:+ *//* By: gvoelkne <marvin@42.fr> +#+ +:+ +#+ *//* +#+#+#+#+#+ +#+ *//* Created: 2026/04/20 09:15:29 by gvoelkne #+# #+# *//* Updated: 2026/05/06 16:33:47 by gvoelkne ### ########.fr *//* *//* ************************************************************************** */
#include "ft_printf.h"
static void ft_bzero(void *s, size_t n){ unsigned char *arr;
arr = s; while (n > 0) { *arr = '\0'; arr += 1; n -= 1; }}
void *ft_calloc(size_t nmemb, size_t size){ unsigned char *res;
if (size != 0 && (nmemb > (SIZE_MAX / size))) return (NULL); res = (unsigned char *)malloc(nmemb * size); if (!res) return (NULL); ft_bzero(res, (nmemb * size)); return ((void *)res);}