最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

strdup

工作和技术 crifan 1790浏览 0评论
strdup
原型:extern char *strdup(char *s);
        
  用法:#include <string.h>
  
  功能:复制字符串s
  
  说明:返回指向被复制的字符串的指针,所需空间由malloc()分配且可以由free()释放。
  
  举例:

      // strdup.c
      
      #include <syslib.h>
      #include <string.h>

      main()
      {
        char *s="Golden Global View";
        char *d;
        
        clrscr();
        
        d=strdup(s);
        printf("%s",d);

        getchar();
        return 0;
      }

转载请注明:在路上 » strdup

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
79 queries in 0.152 seconds, using 22.09MB memory