Check out example codes for "memset". It will help you in understanding the concepts better.

Code Example 1

// memset syntax
void * memset ( void * ptr, int value, size_t num );

Code Example 2

/* memset example */
#include <stdio.h>
#include <string.h>

int main ()
{
  char str[] = "almost every programmer should know memset!";
  memset (str,'-',6);
  puts (str);
  return 0;
}

// Output:
// ------ every programmer should know memset!

Code Example 3

// CPP program to illustrate memset 
//works with var adresses ,basically characters but limit its use to -1 and 0 in int
#include <cstring> 
#include <iostream> 
  
using namespace std; 
  
int main() 
{ 
    char str[] = "geeksforgeeks"; 
    memset(str, 't', sizeof(str)); 
    cout << str; 
    return 0; 
} 
output:
tttttttttttttt

Learn ReactJs, React Native from akashmittal.com