-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
55 lines (49 loc) · 1.53 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
44
45
46
47
48
49
50
51
52
53
54
55
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: edegraev <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/09/20 07:12:43 by edegraev #+# #+# */
/* Updated: 2023/11/08 13:53:40 by edegraev ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *str, int c, size_t n)
{
char *value;
value = str;
while (n)
{
*value = (unsigned char)c;
value++;
n--;
}
return (str);
}
// #include <stdio.h>
// #include <stdlib.h>
// #include <string.h>
// int main()
//{
// size_t i;
// size_t size;
// char *my_array;
// size = 10;
// my_array = (char *)malloc(size * sizeof(char));
// if (my_array == NULL)
// {
// perror("Erreur allocation memoire");
// return 1;
// }
// ft_memset(my_array, 'A', size);
// i = 0;
// while (i < size)
// {
// printf("%c ", my_array[i]);
// i++;
// }
// free(my_array);
// return 0;
// }