I want to put "12345" instead of "defgh"
After the execution of the code written below, this is what i obtain : original : abc12345
but this is the output that i am looking for : abc12345ijklmnop
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char original[20] = "abcdefghijklmnop";
char src[6] = "12345";
memcpy(original+3, src, sizeof(char) * 6);
printf("original : %s\n", original);
}
Thank You
You're copying over the terminating null byte in
src. You want to leave that out.