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