ft_memset: initial implementation
This commit is contained in:
parent
8e87d9f316
commit
872595f75b
3 changed files with 32 additions and 3 deletions
5
Makefile
5
Makefile
|
|
@ -6,7 +6,7 @@
|
|||
# By: kcolin <marvin@42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/14 13:43:59 by kcolin #+# #+# #
|
||||
# Updated: 2024/10/14 15:11:56 by kcolin ### ########.fr #
|
||||
# Updated: 2024/10/15 10:49:47 by kcolin ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
|
@ -17,7 +17,8 @@ SOURCES = ft_isalpha.c \
|
|||
ft_isalnum.c \
|
||||
ft_isascii.c \
|
||||
ft_isprint.c \
|
||||
ft_strlen.c
|
||||
ft_strlen.c \
|
||||
ft_memset.c
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
CC = gcc
|
||||
|
||||
|
|
|
|||
26
ft_memset.c
Normal file
26
ft_memset.c
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_memset.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/15 10:46:44 by kcolin #+# #+# */
|
||||
/* Updated: 2024/10/15 10:58:03 by kcolin ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void *ft_memset(void *dest, int c, t_size len)
|
||||
{
|
||||
t_size i;
|
||||
|
||||
i = 0;
|
||||
while (i < len)
|
||||
{
|
||||
*((unsigned char *)dest + i) = (unsigned char)c;
|
||||
i++;
|
||||
}
|
||||
return (dest);
|
||||
}
|
||||
4
libft.h
4
libft.h
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/15 10:11:54 by kcolin #+# #+# */
|
||||
/* Updated: 2024/10/15 10:40:58 by kcolin ### ########.fr */
|
||||
/* Updated: 2024/10/15 10:46:35 by kcolin ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -23,4 +23,6 @@ int ft_isprint(int c);
|
|||
|
||||
t_size ft_strlen(const char *s);
|
||||
|
||||
void *ft_memset(void *dest, int c, t_size len);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue