strdup() - what does it do in C?

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

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

10条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 00:16

    The strdup() function is a shorthand for string duplicate, it takes in a parameter as a string constant or a string literal and allocates just enough space for the string and writes the corresponding characters in the space allocated and finally returns the address of the allocated space to the calling routine.

提交回复
热议问题