memset in c++
Difference between en1 and en2, changed 70 character(s)
Fill block of memory↵
Sets the first num bytes of the block of memory pointed by ptr to the specified value (interpreted as an unsigned char)↵
↵
Parameters↵
ptr↵
>>>>>>>>>>>>Pointer to the block of memory to fill.↵
value↵
>>>>>>>>>>>>Value to be set. The value is passed as an int, but the function fills the block of memory using the unsigned                        
  char conversion of this value.                      ↵
↵
num↵
>>>>>>>>>>>>Number of bytes to be set to the value.↵
            size_t is an unsigned integral type.↵
↵
↵
↵
↵
/* memset example */↵
#include <stdio.h>↵
#include <string.h>↵
↵
int main ()↵
{↵
  char str[] = "you damn!";↵
  memset (str,'-',6);↵
  puts (str);↵
  return 0;↵
}↵
↵
↵
↵
↵
Output:↵
↵
------ you damn!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English hmtech505 2016-12-29 18:20:35 34
en2 English hmtech505 2016-12-29 18:19:11 70
en1 English hmtech505 2016-12-29 18:17:33 751 Initial revision (published)