#include <stdio.h>
#include <assert.h>
#include <string.h>
//memcpy制作
void* my_memcpy(void* dest, const void* src, size_t num)
{
assert(dest && src);
char* tmp = dest;
while (num--)
{
*(char*)tmp = *(char*)src;
tmp = (char*)tmp+1;
src = (char*)src+1;
}
return dest;
}
int main()
{
int arr[20] = {1,2,3,4,5,6,7};
int arr1[20] = {0};
my_memcpy(arr1, arr, 8);
int i = 0;
for (i=0; i<4;i++)
{
printf("%d\n", arr1[i]);
}
return 0;
}