memcpy Function

  • It copies count characters from *from into *to .
  • It returns *to .


  • Syntax:

      void *memcpy(void *to, const void *from, size_t count);

    Example:

    
    
    
    #include <stdio.h>
    
    #include <string.h>
    
    #define SIZE 80
    
    
    
      int main()
    
      {
    
        char buf1[SIZE], buf2[SIZE];
    
    
    
        strcpy(buf1, "When, in the course of...");
    
        memcpy(buf2, buf1, SIZE);
    
        printf(buf2);
    
    
    
        return 0;
    
      }
    Back