其他分享
首页 > 其他分享> > strdup 字符串复制 free

strdup 字符串复制 free

作者:互联网

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
int main()
{

        char *s = "golden gold view";
        char *d;
        d = strdup(s);
        if(NULL != d)
        {
          printf("%s\n",d);
          free(d);
        }

        return 0;
}
~

  

标签:golden,main,free,char,字符串,strdup,include
来源: https://www.cnblogs.com/hshy/p/16384201.html