Name

memset

Synopsis

Set all bytes of a memory block to a given value

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

The memset() function sets each byte in a block of n bytes to the value c, beginning at the address in dest. The return value is the same as the pointer argument dest.

Example

See the example for mbsinit() in this chapter.

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.