ft_memset
Subject
Understandable explanation
As the man description says, this function writes len
bytes of value c
to the string b
.
The value of c
will be converted to an unsigned char
, so to set this value in the b
string, we'll have to convert the b
string to a pointer to unsigned char
. But remember the return value, we have to return the first parameter of the function, the void *b
string.
So how do we convert this parameter without changing the original one ? Think about temporary variables.
Hints
To build this function, we'll have to declare a temporary variable, an unsigned char *
. We'll then make all our manipulation on this pointer, without touching the original void *b
string.
ft_memset.c
Commented solution
Last updated