strcpy(转载)

转自:http://www.kuqin.com/clib/string/strcpy.html

 

原型:extern char *strcpy(char *dest,char *src);

用法:#include <string.h>

功能:把src所指由NULL结束的字符串复制到dest所指的数组中。

说明:src和dest所指内存区域不可以重叠且dest必须有足够的空间来容纳src的字符串。
返回指向dest的指针。

举例:


// strcpy.c

#include <syslib.h>
#include <string.h>

main()
{
    char *s="Golden Global View";
    char d[20];

    clrscr();

    strcpy(d,s);
    printf("%s",d);

    getchar();
    return 0;
}

posted on 2013-08-01 15:18  次奥砖家  阅读(197)  评论(0编辑  收藏  举报

导航