c语言实现strcp函数

#include <stdio.h>
#include <string.h>
void main() {
    char *strcopy(char *target, char *source);
    char a[] = "hello world~";
    strcopy(a,"thanks!");
    printf("%s
",a);
    getchar();

}
char *strcopy(char *target,char *source) {
    char *p = target;
    if (strlen(target) < strlen(source)) {
        return NULL;
    }
    while (*target++ = *source++) {
        if (*source == '') {
            break;
        }
    }
    *target = '';
    return p;
}
原文地址:https://www.cnblogs.com/airduce/p/8693270.html