-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_bzero.c
42 lines (38 loc) · 1.68 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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_bzero.c :+: :+: */
/* +:+ */
/* By: pavidal <[email protected]> +#+ */
/* +#+ */
/* Created: 2024/10/17 21:36:26 by pavidal #+# #+# */
/* Updated: 2024/10/30 15:06:19 by pavidal ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_bzero(void *s, size_t n)
{
void *ts;
ts = ft_memset(s, 0, n);
}
// int main (void)
// {
// char s[10] = "baby str";
// size_t n = 5;
// printf("%s", s);
// ft_bzero(s, n);
// printf("Buffer after bzero: ");
// for (int i = 0; i < sizeof(s); i++) {
// printf("%d ", s[i]); // Prints the byte values (should all be 0
// }
// return 0;
// }
// This function works the same way as the memset() function,
//except you don't have to specify what character to write,
//it'll always be 0 (NUL character).
// NO RETURN VALUE
//if the number of characters to write you passed as size_t n is 0,
//bzero does nothing.
// Although it's been replaced in modern code by memset,
//ecause bzero is not part of the C standard,
//it is still found in older C code and certain BSD-based systems.