首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

不调用C++/C的字符串库函数,请编纂函数strcpy

2013-10-23 
不调用C++/C的字符串库函数,请编写函数strcpy方案一char *strcpy(char *strDest,const char *strSrc){asse

不调用C++/C的字符串库函数,请编写函数strcpy

方案一

char *strcpy(char *strDest,const char *strSrc){    assert((strDest!=NULL)&&(strSrc!=NULL));    char *address=strDest;    while((*strDest++=*strSrc++)!='\0'){NULL;    }    return address;}

?

方案二

void stringcpy(char *to,const char *form){ assert(to!=NULL&&form!=NULL); while(*form!='\0') {  *to++=*form++; } *to='\0';}

?

热点排行