模拟实现strcpy
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
char* Strcpy(char* destination, const char * source) {
assert(destination != NULL);
assert(source != NULL);
int size = Strlen(source);
int i;
for (i = 0; i < size; ++i) {
destination[i] = source[i];
}
destination[i] = '\0';
return destination;
}
size_t Strlen(const char* str) {
assert(str != NULL);
size_t i = 0;
for (; str[i] != '\0'; ++i);
return i;
}
int main() {
char a[10] = "absdal";
char b[10] = "dasd";
printf("%s\n",Strcpy(b,a));
printf("%d",Strlen(a));
system("pause");
return 0;
}