C Tutorial/string.h/memset
memset
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.
<source lang="cpp">#include <string.h>
- include <stdio.h>
int main(void){
char buf[100]; memset(buf, "\0", 100); memset(buf, "X", 10); printf(buf);
}</source>