#include <string.h>
void *memcpy(void *dest, const void * src, size_t n)
Parameters
dest − This is pointer to the destination array where the content is to be copied, type-casted to a pointer of type void*.
src − This is pointer to the source of data to be copied, type-casted to a pointer of type void*.
n − This is the number of bytes to be copied.
#include <stdio.h>
#include <string.h>
int main () {
const char src[50] = "http://www.tutorialspoint.com";
char dest[50];
strcpy(dest,"Heloooo!!");
printf("Before memcpy dest = %s
", dest);
memcpy(dest, src, strlen(src)+1);
printf("After memcpy dest = %s
", dest);
return(0);
}
int dst[ARRAY_LENGTH];
memcpy( dst, src, sizeof(dst) ); // Good, sizeof(dst) returns sizeof(int) * ARRAY_LENGTH
Code Example |
---|
C :: c str add int |
C :: looping through an array in c |
C :: Command to create a static library in C |
C :: division en java |
C :: stddef.h |
C :: how to join an array of strings c |
C :: insert image material ui |
C :: enum case statement in c |
C :: while loop c |
C :: %g and %e in c |
C :: calling of a void in c |
C :: pointer in c |
C :: iterating through a linked list |
C :: c get pid |
C :: string to number in c |
C :: Command to compile and execute a c file program consecutively |
C :: how to change the smartart style to 3D polished in powerpoint |
C :: c program for fibonacci series |
C :: rand in c |
C :: Unix socket I/O primitives |
C :: VLOOKUP CHECK #N/A |
C :: arcolinux |
C :: gnunet |
C :: type conversion |
C :: analog clock c code for turbo |
C :: [4,5,6] |
C :: putting character in the begginig and end of sring C |
C :: c input is skipped |
C :: pthread_create |
C :: how to stop scanf from adding a new line in c |