-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
47 lines (37 loc) · 1.33 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: uzanchi <uzanchi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/02 12:41:58 by uzanchi #+# #+# */
/* Updated: 2024/05/02 12:42:09 by uzanchi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *str, int value, size_t n)
{
size_t i;
i = 0;
while (i < n)
{
((char *) str)[i] = value;
i++;
}
return (str);
}
/*
#include <stdio.h>
#include <string.h>
int main()
{
char chaine[20];
printf("La chaine avant memset : %s\n", chaine);
memset(chaine, 'A', 20);
printf("La chaine après memset : %s\n", chaine);
ft_memset(chaine, 'B', 19);
printf("La chaine apres ft_memset : %s\n", chaine);
return (0);
}
*/