memset
void * memset ( void * buffer, int c, size_t num ); | string.h |
cplusplus.com |
Fill buffer with specified character.
Sets the first num bytes pointed by buffer to the value specified by
c parameter.
Parameters.
Return Value.
buffer is returned.
Portability.
Defined in ANSI-C.
Example.
/* memset example */
#include <stdio.h>
#include <string.h>
main ()
{
char str[] = "almost every programmer should know memset.";
memset (str,'-',6);
puts (str);
return 0;
}
Output:
------ every programmer should know memset.
See also.
memchr,
memcmp,
memcpy