2024-04-24 10:53:46 +02:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* ft_memset.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
2024-04-29 13:53:00 +02:00
|
|
|
/* By: mmoussou <mmoussou@student.42angoulem +#+ +:+ +#+ */
|
2024-04-24 10:53:46 +02:00
|
|
|
/* +#+#+#+#+#+ +#+ */
|
2024-04-29 13:53:00 +02:00
|
|
|
/* Created: 2023/11/01 22:03:03 by mmoussou #+# #+# */
|
|
|
|
/* Updated: 2023/11/01 22:03:04 by mmoussou ### ########.fr */
|
2024-04-24 10:53:46 +02:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2024-04-29 13:53:00 +02:00
|
|
|
#include "libft.h"
|
2024-04-24 10:53:46 +02:00
|
|
|
|
|
|
|
void *ft_memset(void *s, int c, size_t n)
|
|
|
|
{
|
2024-04-29 13:53:00 +02:00
|
|
|
char *ptr;
|
2024-04-24 10:53:46 +02:00
|
|
|
size_t i;
|
|
|
|
|
|
|
|
i = 0;
|
2024-04-29 13:53:00 +02:00
|
|
|
if (s)
|
2024-04-24 10:53:46 +02:00
|
|
|
{
|
2024-04-29 13:53:00 +02:00
|
|
|
ptr = (char *)s;
|
|
|
|
while (i < n)
|
|
|
|
{
|
|
|
|
ptr[i] = c;
|
|
|
|
i++;
|
|
|
|
}
|
2024-04-24 10:53:46 +02:00
|
|
|
}
|
|
|
|
return (s);
|
|
|
|
}
|