strdup-free or delete
What should we use on pointer returned by strdup. Should I use free or delete. I don't know what(new or malloc) has been used to allocate memory in strdup.
Any idea?
Boder is correct. In the future check the documentation for such functions as it should say which deallocation method to use.
If it's possible to ask this question in your program (i.e. you're using C++), then you almost certainly shouldn't be using strdup() in the first place.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement