1、
#include <stdio.h> char* copy_str(char *d, const char *s) { char *t = d; while(*d++ = *s++) ; return t; } int main(void) { char str[128] = "ABCD"; char tmp[128]; printf("str: %s ", str); printf("tmp = "); scanf("%s", tmp); printf("str: %s ", copy_str(str, tmp)); //函数的返回值为指针,指针指向数组的第一个字符,指针的行为和数组自身一样 return 0; }