Item | Value |
Header file | string.h |
Declaration | void *memset(void *buf, int ch, size_t count); |
Function | copies ch into the first count characters of *buf. |
Return | returns buf. |
The most common use of memset() is to initialize a region of memory to some value.
#include <string.h> #include <stdio.h> int main(void){ char buf[100]; memset(buf, '\0', 100); memset(buf, 'X', 10); printf(buf); }
XXXXXXXXXX
24.5.memset | ||||
24.5.1. | memset |