memcpy
void* my_memcpy(void *dest, void *src, int n) { if (dest == NULL || src == NULL || n <= 0) return NULL; char* pdest = (char*) dest; char* psrc = (char*) src; if (pdest > psrc && pdest < psrc + n) { pdest = pdest + n - 1; psrc = psrc + n - 1; while (n--) { *pdest-- = *psrc--; } } else { while (n--) { *pdest++ = *psrc++; } } return dest; }
strcpy
char* my_strcpy(char* strDest, const char* strSrc) { if (strDest == NULL || strSrc == NULL) return NULL; char* p = strDest; while (*strSrc != '