-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memset.c
More file actions
40 lines (35 loc) · 1.32 KB
/
ft_memset.c
File metadata and controls
40 lines (35 loc) · 1.32 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
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sparth <sparth@student.42heilbronn.de> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/06 15:17:36 by sparth #+# #+# */
/* Updated: 2023/10/11 10:42:42 by sparth ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *b, int c, size_t len)
{
unsigned char *string;
unsigned char convert;
unsigned long i;
string = (unsigned char *) b;
convert = (unsigned char) c;
i = 0;
while (i < len)
{
string[i] = convert;
i++;
}
return (string);
}
// #include <stdio.h>
// int main()
// {
// char og_string [] = "world world";
// ft_memset(og_string + 6, 'g', 5 * sizeof(char));
// printf("%s\n", og_string);
// return (0);
// }