Published
- 1 min read
string to char array c++
The solution for this is noted below
string to char array c++
Solution
std::string myWord = "myWord";
char myArray[myWord.size()+1];//as 1 char space for null is also required
strcpy(myArray, myWord.c_str());
Try other methods by searching on the site. That is if this doesn’t work