-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
38 lines (34 loc) · 1.2 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dalcabre <dalcabre@student.42urduliz.co +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/19 12:03:04 by dalcabre #+# #+# */
/* Updated: 2024/01/11 10:11:41 by dalcabre ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *ptr, int value, size_t n)
{
unsigned char *p;
size_t i;
i = 0;
p = ptr;
while (i < n)
{
*p = (unsigned char)value;
p++;
i++;
}
return (ptr);
}
// #include <stdio.h>
// int main(void)
// {
// char str[20];
// ft_memset(str, 'A', 10);
// printf("%s\n", str);
// return (0);
// }