void *memcpy1(void *desc,const void * src,size_t size)
{
if((desc == NULL) && (src == NULL))
{
return NULL;
}
unsigned char *desc1 = (unsigned char*)desc;
unsigned char *src1 = (unsigned char*)src;
while(size-- >0)
{
*desc1 = *src1;
desc1++;
src1++;
}
return desc;
}
int _tmain(int argc, _TCHAR* argv[])
{
int dest[2] = {0};
const char src[5] = "1234";
memcpy1(dest,src,sizeof(src));
printf((char *)dest);
int m = -1;
return 0;
}
上面这行代码可以运行
但是,为什么我把int dest[2] = {0};const char src[5] = "1234";这两行代码改成string *p="aaaa";和string *q="bbbbbb",就不行了,希望各位朋友可以解答得详细一点,脑子太蠢。。不好使
onemoo
慕仙1118221
相关分类