阅读(2863) (0)

strcpy

2015-11-11 15:58:10 更新

 原型: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;
      }