-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memset.c
30 lines (26 loc) · 1.14 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: inwagner <inwagner@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/03 18:10:08 by inwagner #+# #+# */
/* Updated: 2023/06/09 18:37:38 by inwagner ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *src, int c, size_t n)
{
size_t i;
char *str;
str = (char *)src;
i = 0;
while (n && i < n)
str[i++] = (char)c;
return (src);
}
/*
Copia o caractere `c` para os primeiros `n` caracteres em `*str`.
Retorna o ponteiro `str`.
*/