您的位置:首页 > 编程语言 > C语言/C++

模拟实现strcpy(C语言)

2017-09-07 22:07 351 查看
#include<stdio.h>
#include<stdlib.h>
#include<Windows.h>
#include<string.h>
#include<assert.h>

char* my_strcpy(char* dest,const char* src)
{
char *ret = dest;
assert(src != NULL);
assert(dest != NULL);
while(*dest++ = *src++)
{
;
}
return ret;
}

int main()
{
char arr[80]={0};
printf("string=%s\n",my_strcpy(arr,"hello world"));
system("pause");
return 0;
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: