memset
 
Syntax

         

#include "mem.h"

 void* memset( void* buffer, int ch, unsigned int count );
 

The function memset() copies ch into the first count characters of buffer, and returns buffer.

memset() is useful for intializing a section of memory to some value. For example, this command:

 

   const int ARRAY_LENGTH;
   
char the_array[ARRAY_LENGTH];
   
...
   
// zero out the contents of the_array
   memset
( the_array, '\0', ARRAY_LENGTH );
 

...is a very efficient way to set all values of the_array to zero.