rt/libft/ft_memset.c

28 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: scebula <scebula@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/23 16:17:13 by scebula #+# #+# */
/* Updated: 2015/12/04 00:23:59 by scebula ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *b, int c, size_t n)
{
unsigned char *p;
p = (unsigned char *)b;
while (n > 0)
{
*p = (unsigned char)c;
n--;
p++;
}
return (b);
}