C语言strcat的实现

#include
#include
#include
void mystrcat(char *arr1, char *arr2,int leng)
{
    int i=1,m=0,length=0;
    while(i)
    {
        if (*(arr1 + m) != '\0')
        {
            length++;
            m++;
            continue;
        }
        i = 0;
    }
    for (i = length, m = 0; i <= length + leng; m++, i++)
    {
        *(arr1 + i) = *(arr2 + m);
    }
}
int main()
{
    char arr1[10] = "abcd";
    char *arr2 = "efghh";
    int leng = strlen(arr2);
    mystrcat(arr1, arr2,leng);
    printf("%s", arr1);
    system("pause");
    return 0;
}

网站名称:C语言strcat的实现
本文地址:http://scyanting.com/article/ihhjsd.html