strdup() - what does it do in C?

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

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

10条回答
  •  我在风中等你
    2020-11-22 00:26

    The most valuable thing it does is give you another string identical to the first, without requiring you to allocate memory (location and size) yourself. But, as noted, you still need to free it (but which doesn't require a quantity calculation, either.)

提交回复
热议问题