maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_memset.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_memset.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: rmikhayl <rmikhayl@student.42london.c +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2023/12/17 17:25:28 by rmikhayl #+# #+# */
9
/* Updated: 2023/12/17 17:25:28 by rmikhayl ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "
libft.h
"
14
15
/* *************************** ft_memset ************************************ */
16
/* Fills the first 'n' bytes of memory at 's' with the byte value 'c'. */
17
/* The original memory at 's' remains unchanged. */
18
/* */
19
/* Parameters: */
20
/* - 's': A pointer to the memory to fill. */
21
/* - 'c': The byte value used for filling. */
22
/* - 'n': The number of bytes to fill at 's'. */
23
/* */
24
/* In layman's terms: It's like painting a specific area in memory with a */
25
/* particular color, ensuring that the rest of the memory is untouched. */
26
/* ************************************************************************** */
27
28
void
*
ft_memset
(
void
*s,
int
c,
size_t
n)
29
{
30
unsigned
char
*ptr;
31
32
ptr = s;
33
while
(n-- > 0)
34
*ptr++ = (
unsigned
char)c;
35
return
(s);
36
}
ft_memset
void * ft_memset(void *s, int c, size_t n)
Definition
ft_memset.c:28
libft.h
lib
libft
src
ft_memset.c
Generated by
1.9.8