-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memset.c
More file actions
37 lines (34 loc) · 1.39 KB
/
ft_memset.c
File metadata and controls
37 lines (34 loc) · 1.39 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jowagner <jowagner@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/12 14:02:28 by jowagner #+# #+# */
/* Updated: 2024/12/12 19:47:56 by jowagner ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Fills the first n bytes of memory area pointed to by s with the
* constant byte c.
*
* @param s Pointer to the memory area to be filled.
* @param c The byte to fill the memory with (converted to an unsigned char).
* @param n Number of bytes to be filled.
* @return A pointer to the memory area s.
*/
void *ft_memset(void *s, int c, size_t n)
{
size_t i;
unsigned char *ptr;
i = 0;
ptr = (unsigned char *)s;
while (i < n)
{
ptr[i] = (unsigned char)c;
i++;
}
return (s);
}