void memset(void*dest, int c, size_t count );

   void memset(void*dest,    int c,    size_t count  );

Parameters

dest

Pointer to destination.

c

Character to set.

count

Number of characters.

Remarks
Sets the first count characters of dest to the character c.

Required hearder file
<string.h>

Examples
// crt_memset.c
/* This program uses memset to
* set the first four chars of buffer to "*".
*/

#include <string.h>
#include <stdio.h>

int main( void )
{
char buffer[] = "This is a test of the memset function";

printf( "Before: %s\n", buffer );
memset( buffer, '*', 4 );
printf( "After: %s\n", buffer );
}
After:  **** is a test of the memset function



posted on 2009-10-14 17:55  Homography Matrix  阅读(606)  评论(0编辑  收藏  举报

导航