Friday, July 20, 2012

What is the use memset(), memcpy(), memmove() in C language?and memset(), memcpy(), memmove() example programs in c

memset()
Syntax:
#include <string.h>
void *memset( void *str, int ch, size_t n );

Description:
The function memset() copies ch into the first 'n' characters of str, and returns str. memset() is useful for intializing a section of memory to some value. For example:
memset(array, '\0', sizeof(array) );
it is a very efficient way to set all values of array to NULL.