-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memset.c
41 lines (35 loc) · 1.23 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yeparra- <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/09/18 14:35:30 by yeparra- #+# #+# */
/* Updated: 2023/11/27 23:11:38 by yeparra- ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
size_t i;
unsigned char *p;
p = s;
i = 0;
while (n > 0)
{
*p = c;
p++;
n--;
}
return (s);
}
int main()
{
char s[12] = "Hola, Mundo";
unsigned char *result;
printf("String original: %s\n", s);
result = ft_memset(s, 'X', 5);
printf("String modificada: %s\n", result);
return (0);
}