#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
char * my_strcpy(char *dst, const char *src)
{
int i = 0;
while (*(src + i) != '\0')
{
*(dst + i) = *(src + i);
i++;
}
*(dst + i) = '\0';
return dst;
}
int main()
{
char src[] = "abc";
char dst[100];
char tmp[100] = "hello ";
strcat(tmp, my_strcpy(dst, src)); //函数的返回值继续做另一个函数的参数,链式表达式
printf("tmp = %s\n", tmp);
system("pause");
return 0;
}
strcpy的实现
最新推荐文章于 2022-11-16 16:11:19 发布