copy string to char array code example
Example 1: java string to char array
String str = "example";
char[] ch = str.toCharArray();
Example 2: 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());
Example 3: convert string to char array in java
String str = "example";
char[] ch = str.toCharArray();