/ libft / ft_calloc.c
ft_calloc.c
 1  /* ************************************************************************** */
 2  /*                                                                            */
 3  /*                                                        :::      ::::::::   */
 4  /*   ft_calloc.c                                        :+:      :+:    :+:   */
 5  /*                                                    +:+ +:+         +:+     */
 6  /*   By: gychoi <marvin@42.fr>                      +#+  +:+       +#+        */
 7  /*                                                +#+#+#+#+#+   +#+           */
 8  /*   Created: 2022/07/09 14:06:14 by gychoi            #+#    #+#             */
 9  /*   Updated: 2022/07/11 13:29:05 by gychoi           ###   ########.fr       */
10  /*                                                                            */
11  /* ************************************************************************** */
12  
13  #include "libft.h"
14  
15  void	*ft_calloc(size_t count, size_t size)
16  {
17  	void	*ptr;
18  
19  	ptr = malloc(count * size);
20  	if (!ptr)
21  		return (NULL);
22  	ft_bzero(ptr, count * size);
23  	return (ptr);
24  }