指针实现字符串复制

来源:互联网 发布:网络直销的优点 编辑:程序博客网 时间:2024/05/16 13:48

void str_cat(char *deststr, char *srcstr)

{

    char *dtemp = deststr;

    char *stemp = srcstr;

    while(*dtemp != '\0')

    {

        dtemp++;

    }

    while(*srcstr != '\0')

    {

        *dtemp = *srcstr;

        dtemp++;

        srcstr++;

    }

    *dtemp = '\0';

}

0 0
原创粉丝点击