#include <stdio.h>
int main(int argc,const char* argv[])
{
char src[128] = {0};
char dest[128] = {0};
int i = 0;
printf("请输入两个字符串:\n");
scanf("%s %s",src,dest);
printf("before:\n");
printf("src = %s\ndest = %s\n\n",src,dest);
/*
while(1)
{
if(src[i] == '\0')
break;
dest[i] = src[i];
i++;
}
*/
/*
while((src[i]!='\0') && (dest[i] = src[i]))
i++;
*/
while((dest[i] = src[i]) && (src[++i]!= '\0'));
dest[i] = '\0';
printf("after :\n");
printf("src = %s\ndest = %s\n",src,dest);
return 0;
}
my_strcpy
最新推荐文章于 2022-08-04 12:19:17 发布