-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
33 lines (30 loc) · 1.32 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: pix <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/17 13:17:58 by stales #+# #+# */
/* Updated: 2022/04/04 02:56:21 by pix ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Fills the first n bytes of the memory area pointed to by s
* with the constant byte c.
*
* @param s Destination memory area
* @param c Char to fill with
* @param n First bytes to fill
*
* @return (void *) The ft_memset() function returns a pointer to dest.
*/
void *ft_memset(void *s, int c, t_size n)
{
unsigned char *tmp;
tmp = (unsigned char *)s;
while (n--)
*tmp++ = (unsigned char)c;
return (s);
}