-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
43 lines (39 loc) · 1.34 KB
/
ft_memset.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kyungkim <[email protected] +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/12 18:26:22 by kyungkim #+# #+# */
/* Updated: 2024/11/13 17:28:38 by kyungkim ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
char *start;
start = s;
while (n > 0)
{
*start = (unsigned char) c;
start += 1;
n--;
}
return (s);
}
/*
#include <string.h>
#include <stdio.h>
int main(void)
{
char test1[] = "hihi";
char test2[] = "hihi";
memset(test1, -200, 4);
ft_memset(test2, -200, 4);
printf("%s\n", test1);
printf("%s\n", test2);
printf("%p\n", memset(test1, -200, 4));
printf("%p\n", ft_memset(test1, -200, 4));
}
*/