c语言 11-3

1、

#include <stdio.h>

char *copy(char *d, const char *s)
{
    char *t = d;
    
    while(*d++ = *s++)
        ;
    return t;
}

int main(void)
{
    char str1[] = "abcd";
    char str2[128];
    printf("str2: "); scanf("%s", str2);
    
    printf("str1 after replication: %s
", copy(str1, str2));
    return 0;
}

原文地址:https://www.cnblogs.com/liujiaxin2018/p/14842732.html