2024-10-15 11:19:02 +02:00
|
|
|
/* ************************************************************************** */
|
|
|
|
|
/* */
|
|
|
|
|
/* ::: :::::::: */
|
|
|
|
|
/* ft_memset.c :+: :+: :+: */
|
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
|
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
|
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
|
/* Created: 2024/10/15 10:46:44 by kcolin #+# #+# */
|
2024-10-16 15:20:28 +02:00
|
|
|
/* Updated: 2024/10/16 15:18:07 by kcolin ### ########.fr */
|
2024-10-15 11:19:02 +02:00
|
|
|
/* */
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
|
|
#include "libft.h"
|
|
|
|
|
|
2024-10-16 15:20:28 +02:00
|
|
|
void *ft_memset(void *s, int c, size_t n)
|
2024-10-15 11:19:02 +02:00
|
|
|
{
|
2024-10-16 15:20:28 +02:00
|
|
|
size_t i;
|
2024-10-15 11:19:02 +02:00
|
|
|
|
|
|
|
|
i = 0;
|
2024-10-15 14:44:11 +02:00
|
|
|
while (i < n)
|
2024-10-15 11:19:02 +02:00
|
|
|
{
|
2024-10-15 14:44:11 +02:00
|
|
|
*((unsigned char *)s + i) = (unsigned char)c;
|
2024-10-15 11:19:02 +02:00
|
|
|
i++;
|
|
|
|
|
}
|
2024-10-15 14:44:11 +02:00
|
|
|
return (s);
|
2024-10-15 11:19:02 +02:00
|
|
|
}
|