-
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.38 KB
/
ft_memset.c
File metadata and controls
39 lines (35 loc) · 1.38 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: sanmetol <sanmetol@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/08 16:50:20 by sanmetol #+# #+# */
/* Updated: 2023/05/19 18:15:35 by sanmetol ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *b, int c, size_t len)
{
unsigned char *str;
str = b;
while (len-- > 0)
*str++ = (unsigned char) c;
return (b);
}
/*int main() {
char str[] = "hola";
ft_memset(str, 'A', 2);
for (int i = 0; i < sizeof(str) - 1; i++) {
printf("%c ", str[i]);
}
/////ORIGINAL/////
char str_o[] = "hola";
memset(str_o, 'A', 2);
printf("\nORIGINAL\n");
for (int i = 0; i < sizeof(str_o) - 1; i++) {
printf("%c ", str_o[i]);
}
return 0;
}*/