-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memset.c
More file actions
39 lines (35 loc) · 1.28 KB
/
ft_memset.c
File metadata and controls
39 lines (35 loc) · 1.28 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bhielsch <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/05 11:12:02 by bhielsch #+# #+# */
/* Updated: 2022/10/07 16:21:51 by bhielsch ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
#include <stdio.h>
void *ft_memset(void *s, int c, size_t n)
{
size_t i;
unsigned char *dest;
i = 0;
dest = (unsigned char *)s;
while (i < n)
{
dest[i] = c;
i++;
}
return (s);
}
// int main()
// {
// int n = 42;
// unsigned char str[42];
// int c = 'L';
// ft_memset(str, c, n);
// printf("Mine: %s", str);
// //printf("OG: %p\n", memset(str, c, n));
// }