String h C Tutorial

Item Value
Header filestring.h
Declarationvoid *memset(void *buf, int ch, size_t count);
Functioncopies ch into the first count characters of *buf.
Returnreturns buf.
The most common use of memset() is to initialize a region of memory to some value.

#include 
#include 
int main(void){
  char buf[100];
  memset(buf, '\0', 100);
  memset(buf, 'X', 10);
  printf(buf);
}
XXXXXXXXXX