strdup() - what does it do in C?

前端 未结 10 2275
情话喂你
情话喂你 2020-11-21 23:22

What is the purpose of the strdup() function in C?

10条回答
  •  执念已碎
    2020-11-22 00:29

    From strdup man:

    The strdup() function shall return a pointer to a new string, which is a duplicate of the string pointed to by s1. The returned pointer can be passed to free(). A null pointer is returned if the new string cannot be created.

提交回复
热议问题