-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_bzero.c
More file actions
38 lines (33 loc) · 1.21 KB
/
ft_bzero.c
File metadata and controls
38 lines (33 loc) · 1.21 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_bzero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sarfreit <sarfreit@student.42porto.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/27 15:39:15 by sarfreit #+# #+# */
/* Updated: 2025/09/27 15:39:15 by sarfreit ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_bzero(void *s, size_t n)
{
char *temp;
temp = (char *) s;
while (n > 0)
{
*temp = 0;
temp++;
n--;
}
}
/*
int main(void)
{
char str[20] = "Hello World!";
printf("Before: %s\n", str);
ft_bzero(str + 6, 5); // zero 5 bytes after index 6
printf("After: %s\n", str);
return (0);
}
*/