The following is an example showing what I want:
int buf[3] = {10, 20, 30};
int * send_buf = (int *)malloc(5 * sizeof(int));
*send_buf = 1;
*(send_buf + 4) = 1;
After copy buf to send_buf, the values in send_buf should be :
1 10 20 30 1
Could anyone let me know what's the most efficient way to do this without using memcpy()
or memmove()
?