//src[5~15]的数据复制到dest[20~30]的位置
unsignedchar*src=(unsignedchar*)malloc(20*sizeof(unsignedchar));
memset(src,10,20);
unsignedchar*dest=(unsignedchar*)malloc(40*sizeof(unsignedchar));
memset(dest,2,40);
unsignedchar*oldSrc=src;
//movesrcposto5
for(inti=0;i<5;i++){
src++;
}
unsignedchar*oldDest=dest;
for(intj=0;j<20;j++){
dest++;
}
memcpy(dest,src,10);
for(intm=0;m<40;m++){
printf("dest[%d]=%d\n",m,oldDest[m]);
}
网友评论