字符串拷贝函数 char *strcpy(char *dest, const char *src)

//字符串拷贝函数 char *strcpy(char *dest, const char *src)

#include <stdio.h>

char *strcpy(char *dest, const char *src)
{
    char *p = dest;
    while ((*dest++=*src++)!='\0');
    return p;
}

int main()
{
    char *str1 = "adbcdd"; 
    char str2[15];
    strcpy(str2,str1);
    printf("%s",str2);
    return 0;
}

image

posted @ 2012-10-12 13:49  涵曦  阅读(7530)  评论(0编辑  收藏  举报