memset function(Initialize Memory Block) in C Language – example and detail

In the C Programming Language, the memset characteristic stores c into the first n characters of the object pointed to by s.


The syntax for the memset function in the C Language is:

void *memset(void *s, int c, size_t n);

Parameters or Arguments

s A pointer to a reminiscence block that will be filled. c The price to be stored. n The wide variety of characters to be stored.


The memset function returns s.

Required Header

In the C Language, the required header for the memset feature is:

#include <string.h>

Applies To

In the C Language, the memset feature can be used in the following versions:

ANSI/ISO 9899-1990

See Also

Other C features that are noteworthy when dealing with the memset function:

memcpy feature memmove feature