base c lib without external lib
This commit is contained in:
22
ft_memset.c
Normal file
22
ft_memset.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_memset.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/11/05 11:20:47 by dgaillet #+# #+# */
|
||||
/* Updated: 2025/11/05 11:44:56 by dgaillet ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void *ft_memset(void *s, int c, size_t n)
|
||||
{
|
||||
if (n <= 0)
|
||||
return (s);
|
||||
*((char *) s) = c;
|
||||
ft_memset(s + 1, c, n - 1);
|
||||
return (s);
|
||||
}
|
||||
Reference in New Issue
Block a user