-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_bzero.c
More file actions
48 lines (45 loc) · 1.46 KB
/
ft_bzero.c
File metadata and controls
48 lines (45 loc) · 1.46 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
38
39
40
41
42
43
44
45
46
47
48
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_bzero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: isllobre <isllobre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/13 13:12:49 by isllobre #+# #+# */
/* Updated: 2023/10/17 09:50:40 by isllobre ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_bzero(void *s, size_t n)
{
size_t i;
i = 0;
while (i < n)
{
((unsigned char *)s)[i] = 0;
i++;
}
}
/*
int main(void)
{
char s[10] = "1234567890";
ft_bzero(s, 5);
printf("%s\n", s);
return (0);
}
*/
/*
** La función ft_bzero pone a cero (bytes con valor '\0') los primeros 'n' bytes
** del área de memoria apuntada por 's'.
**
** Parámetros:
** - s: un puntero a la zona de memoria a poner a cero.
** - n: el número de bytes a poner a cero.
**
** Valor de retorno:
** - No devuelve ningún valor.
**
** Notas:
** - Si 'n' es cero, la función no hace nada.
*/