memset Function

  • It copies ch into the first count characters of *buf .
  • It returns buf .


  • Syntax:

      void *memset(void *buf, int ch, size_t count);

    Example:

    #include <string.h>
    
    #include <stdio.h>
    
    
    
    int main()
    
    {
    
      char buf[100];
    
      memset(buf, '\0', 100);
    
      memset(buf, 'X', 10);
    
      printf(buf);
    
      return 0;
    
    }
    Back