-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_bzero.c
43 lines (36 loc) · 1.25 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
35
36
37
38
39
40
41
42
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_bzero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tpouget <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/05/14 17:04:37 by tpouget #+# #+# */
/* Updated: 2020/05/14 17:05:22 by tpouget ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
void ft_bzero(void *s, size_t n)
{
size_t i;
unsigned char *p;
i = 0;
p = (unsigned char*)s;
while (i < n)
{
p[i] = '\0';
i++;
}
}
/*
#include <string.h>
#include <stdio.h>
int main(void)
{
char arr[] = "hello";
ft_bzero(arr, 3);
for (int i = 0; i < sizeof(arr); i++)
printf("arr[%d] is null ? : %s\n", i, arr[i] ? "No" : "Yes");
return 0;
}
*/