回覆列表
-
1 # 萌無敵半島素兮
-
2 # 使用者8125325138772
void *my_memmove(void *dst,const void *src,int count)
{
char *ret;
char *dst_t;
char *src_t;
ret = (char *)dst;
if ((unsigned char*)dst
(unsigned char *)dst >= ((unsigned char *)src + count))
{
dst_t = (char *)dst;
src_t = (char *)src;
while (count--)
{
*dst_t++ = *src_t++;
}
}
else
{
dst_t = (char *)dst + count - 1;
src_t = (char *)src + count - 1;
while (count--)
{
*dst_t-- = *src_t--;
}
}
return(ret);
}
在程式最前面定義:
#definemyprintfprintf
後面的myprintf就相當於printf了。