Cub3D/libft/memory/ft_memset.c
2024-10-31 18:17:43 +01:00

37 lines
1.3 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/07 16:50:29 by rparodi #+# #+# */
/* Updated: 2024/10/31 17:56:59 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Fills a block of memory with a specified byte
*
* @param s Pointer to the memory area to fill
* @param c Byte value to be set in the memory
* @param n Number of bytes to be set to the value c
*
* @return A pointer to the memory area s
*/
void *ft_memset(void *s, int c, size_t n)
{
char *str;
size_t i;
i = 0;
str = (char *)s;
while (i < n)
{
str[i] = c;
i++;
}
return (str);
}