memset

Fills memory with the number of characters specified by length with a specified value.

Library:LibC
Classification:ANSI
Service:Characters and Strings

Syntax

  #include <string.h> 
   
  void *memset (
     void     *s,
     int       c,
     size_t    length);
  

Parameters

s

(IN) Points to the object.

c

(IN) Specifies the character.

length

(IN) Specifies the number of characters to copy.

Return Values

Returns a pointer to s.

Remarks

The memset function copies c (converted to an unsigned char) into each of the length bytes of the object pointed to by s.

Because allocated memory can contain discarded data, this function allows you to set the memory to a known value.

See Also