C examples for string.h:memset
function
<cstring> <string.h>
Fill block of memory
void* memset (void* ptr, int value, size_t num );
Parameter | Description |
---|---|
ptr | Pointer to the block of memory to fill. |
value | Value to be set. |
num | Number of bytes to be set. |
ptr is returned.
#include <stdio.h> #include <string.h> int main ()//from ww w . j av a2s.c o m { char str[] = "this is a test! this is a test test test test."; memset (str,'-',6); puts (str); return 0; }