memset has nothing to do with setting memory to the heap, as Uhrwerk said it is setting the memory address to the character you specify (usually 0 to clear the previous data)

Example:
Code:
// crt_memset.c
/* This program uses memset to
 * set the first four chars of buffer to "*".
 */

#include <memory.h>
#include <stdio.h>

int main( void )
{
   char buffer[] = "This is a test of the memset function";

   printf( "Before: %s\n", buffer );
   memset( buffer, '*', 4 );
   printf( "After:  %s\n", buffer );
}



Output:
Code:
Before: This is a test of the memset function
After:  **** is a test of the memset function


Resource