-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_bzero.c
34 lines (30 loc) · 1.16 KB
/
ft_bzero.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_bzero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: antandre <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/02 18:31:20 by antandre #+# #+# */
/* Updated: 2024/06/27 12:09:55 by antandre ### ########.fr */
/* */
/* ************************************************************************** */
#include <stddef.h>
/*
* Erases the data in the n bytes of memory starting from the position
* pointed to by s, by writing zeros ('\0').
*/
void ft_bzero(void *s, size_t n)
{
char *str;
size_t i;
if (!s)
return ;
str = (char *)s;
i = 0;
while (i < n)
{
str[i] = '\0';
i++;
}
}