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.

buffer
Pointer to block of data to be filled with c.
c
character value to set.
num
Number of bytes to copy.

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


© The C++ Resources Network, 2000