网站建设资讯

NEWS

网站建设资讯

C语言strcpy的实现

#include
#include
void mystr(char *arr2, char *arr1,int length)
{
    int i;
    for (i = 0; i < length; i++)
    {
        if (*(arr1+i) != '\0')
        {
            *(arr2 + i) = *(arr1 + i);
        }
    }
}
int main()
{
    char arr1[]= "abcde";
    char arr2[]= "     ";
    int length = strlen(arr1);
    mystr(arr2, arr1,length);
    printf("%s", arr2);
    system("pause");
    return 0;
}

当前名称:C语言strcpy的实现
文章位置:http://cdweb.net/article/jsjsee.html