DEV Community

s
s

Posted on

Answer:

Yes there is an alternative.

  • get a size of string
  • create an array of the same size as is the string
  • copy the contents of the string into that array
  • point nm to your allocated array

Or you could use strdup - btw strdup is not part of C++ STL

Top comments (0)