std::string myWord = "myWord";
char myArray[myWord.size()+1];//as 1 char space for null is also required
strcpy(myArray, myWord.c_str());
const char *array = tmp.c_str(); //For const char array
char *array = &tmp[0]; // If you need to modify the array
std::string strCoffee = "Nescafe";
const char *charCoffee = strCoffee.c_str();
std::string myWord = "myWord";
char myArray[myWord.size()+1];//as 1 char space for null is also required
strcpy(myArray, myWord.c_str());
const char *array = tmp.c_str(); //For const char array
char *array = &tmp[0]; // If you need to modify the array
std::string strCoffee = "Nescafe";
const char *charCoffee = strCoffee.c_str();