189 8069 5689

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://cdxtjz.com/article/ihhjsd.html

其他资讯