首页 > 其他 > 详细

字符串copy

时间:2015-10-05 23:20:55      阅读:381      评论:0      收藏:0      [点我收藏+]
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>



//字符串copy操作

//字符串copy函数
void copy_str21(char *from,char *to)
{
    for (; *from != \0; from++, to++)
    {
        *to = *from;
    }
    *to = \0;
    return;
}
void copy_str22(char *from,char *to)
{
    while(*to++ = *from++);
}
int main()
{
    char *from ="abcdefg";
    char buf2[100];
    /*copy_str21(from,buf2);
    printf("buf2:%s\n",buf2);*/
    copy_str22(from, buf2);
    printf("buf2:%s\n", buf2);
    system("pause");
    return 0;
}

 

字符串copy

原文:http://www.cnblogs.com/linst/p/4856404.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!