Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    He doesn't need to if he just assigns an address, which is what he's doing. He may not want to create physical copies of the string. Commented Apr 2, 2014 at 14:48
  • @PeterSchneider You are correct. He does not need to in his specific case. Commented Apr 2, 2014 at 15:20
  • @user3489828 Remember to free the memory allocated by strdup with free. Commented Apr 3, 2014 at 12:30