ft_bzero
Subject
BZERO(3) (simplified)
NAME
bzero -- write zeroes to a bye string
SYNOPSIS
void bzero(void *s, size_t n);
DESCRIPTION
The bzero() function writes n zeroed bytes to the string s. If n is zero, bzero() does nothing.
Understandable explanation
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).
This function does not return anything and if the number of characters to write you passed as size_t n
is 0
, bzero
does nothing.
Hints
void ft_bzero(void *s, size_t n)
{
/* declare a temporary pointer */
/* make the temporary pointer equal to *s converted to a char * */
/* loop on the temporary pointer while we didn't reach n characters */
/* in that loop, set the current byte equal to 0 */
}
Commented solution
Last updated
Was this helpful?