c语言的字符串拷贝函数的精简

#include <stdio.h>
#include <string.h>
void str_cpy(char * to, char *from)
{
    while ((*to++ = *from++) != '\0');
    return;
}
int main()
{
    char a[128];
    str_cpy(a,"hello");
    printf("a:%s\n",a);
    return 0;
}

posted @ 2015-06-15 21:19  张不正  阅读(268)  评论(0编辑  收藏  举报
返回顶部