C语言strdup函数使用

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>


int main()
{

    // 解决字符串常量的坑  不可以指针修改  const char* xx = "xxx"
    char* pstring =  strdup("1080*720p");
    printf("%s\n",pstring);
    free(pstring);

    for(;;);
    return 0;
}

  

posted @ 2020-09-13 20:03  卷哭你  阅读(361)  评论(0编辑  收藏  举报