实现memcpy 使用C语言

#define _CRT_SECURE_NO_WARNINGS
#include 
#include 
#include 
void* Mencoy(void* dest, void* arr, size_t count) {
	void* ret = dest;
	assert(dest != NULL);
	assert(arr != NULL);
	while (--count) {
		*(char *)dest = *(char *)arr;
	}
	return ret;
}


int main() {
	char dest[] = "abcde";
	char arr[] = "fgh";
	int count =2;
	char *p = Mencoy(dest, arr, count);
	printf("%s", p);

	system("pause");
	return 0;
}

 

你可能感兴趣的:(实现memcpy 使用C语言)