#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<assert.h>
//模拟实现memcpy函数
void* my_memcpy(void* dest,const const void* str,size_t a)
{
assert(dest && str);
void* aph = dest;
int i = 0;
while(a--)
{
*(char*)dest = *(char*)str;
dest = (char*)dest + 1;
str = (char*)str + 1;
}
return dest;
}
void test()
{
/*char arr[] = "xxxxxx";
char bata[] = "aaaaa";*/
int arr[] = { 1,2,3,4,5 };
int bata[] = { 3,4 };
my_memcpy(arr, bata, sizeof(bata[0]) * 2);
int sz = sizeof(arr) / sizeof(arr[0]);
int i = 0;
for(i = 0; i < sz ; i++)
{
printf("%d ", arr[i]);
}
}
int main()
{
test();
return 0;
}