-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_bzero.c
More file actions
44 lines (41 loc) · 1.44 KB
/
Copy pathft_bzero.c
File metadata and controls
44 lines (41 loc) · 1.44 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_bzero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: atok <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 11:07:31 by atok #+# #+# */
/* Updated: 2022/10/25 15:42:48 by atok ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_bzero(void *str, size_t n)
{
size_t i;
unsigned char *tmp;
tmp = str;
i = 0;
while (i < n)
{
tmp[i] = 0;
i++;
}
}
/*
#include <unistd.h>
int main(void)
{
char str [] = "testing";
ft_bzero(str+4,2);
write(1, str, 8);
write(1, "\n", 1);
}
*/
/*
* printf dont work because it recognise null as the terminator
* can test by chaning the 0 in tmp[i] = x to anything else
* also before printf ft_bzero(str + 4 , 2); to shift the array in str
* by shifting the array forward it will show 'test' only
* but should to show 'testxxg'
*/