码迷,mamicode.com
首页 > 编程语言 > 详细

c++ 实现strcpy(),strlen()

时间:2014-10-01 18:55:41      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   ar   sp   div   c   on   

char* strcpy(char *strDest,const char *strSrc)
{
    char *result=strDest;

    assert((strDest!=NULL)&&(strSrc!=NULL));
    while((*strDest++=*strSrc++)!=\0);
    
    return result;
}

int strlen(const char *str)
{
    int count=0;

    assert(str!=NULL);
    while(*str++!=\0)
        count++;

    return count;
}
 

 

c++ 实现strcpy(),strlen()

标签:des   style   blog   color   ar   sp   div   c   on   

原文地址:http://www.cnblogs.com/huangcongcong/p/4003429.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!