Answers for "return a char array from a function c++"

C++
12

string to char array c++

std::string myWord = "myWord";
char myArray[myWord.size()+1];//as 1 char space for null is also required
strcpy(myArray, myWord.c_str());
Posted by: Guest on August-27-2020

Code answers related to "return a char array from a function c++"

Browse Popular Code Answers by Language