-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_bzero.c
51 lines (45 loc) · 1.53 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
44
45
46
47
48
49
50
51
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_bzero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mlaffita <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/18 16:33:27 by mlaffita #+# #+# */
/* Updated: 2025/02/06 17:02:16 by mlaffita ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/* *******************************************************
La fonction bzero() met à 0 les n premiers octets du bloc
pointé par s (octets contenant « \0 »).
**********************************************************
*/
void ft_bzero(void *s, size_t n)
{
char *str;
str = (char *)s;
while (n--)
*str++ = '\0';
}
/*
#include <stdio.h>
int main()
{
char string[] = "hello world!";
int i = 0;
printf("avant fonction : %s\n", string);
ft_bzero(string, 5);
printf("apres fonction :");
while ( i < sizeof(string))
{
if (string[i] == '\0')
printf("\\0");
else
printf("%c", string[i]);
i++;
}
printf("\n");
return (0);
}
*/