-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memset.c
More file actions
39 lines (32 loc) · 1.19 KB
/
ft_memset.c
File metadata and controls
39 lines (32 loc) · 1.19 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: marvin <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/19 18:35:11 by marvin #+# #+# */
/* Updated: 2022/05/19 18:35:57 by marvin ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
char *ptr;
ptr = (char *)s;
while (n > 0)
{
ptr[n - 1] = c;
n--;
}
return (s);
}
/*int main()
{
char str[50];
strcpy(str, "This is string.h library function");
puts(str);
ft_memset(str, '$', 3);
puts(str);
return (0);
}*/