-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
44 lines (36 loc) · 1.43 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tauer <tauer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/06 15:35:52 by tauer #+# #+# */
/* Updated: 2023/11/06 15:35:52 by tauer ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *str, int c, size_t n)
{
unsigned char *ptr;
ptr = (unsigned char *)str;
while (n > 0)
{
*ptr++ = (unsigned char)c;
n--;
}
return (str);
}
// int main(void)
// {
// int array [] = {15 , 20, 50, 60 ,42, 42 , 20};
// int size = sizeof(int) * 7;
// for(int size = 0; size < 7; size++)
// printf("%d ", array[size]);
// printf("\n");
// ft_memset(array, '0' , size);
// for(size = 0; size < 7; size++)
// printf("%c ", array[size]);
// printf("\n");
// return (0);
// }