If you would like to do something like
std::string str = !23456789";
// This is invalid...
char ch1[] = str;
// None of the alternative below are valid.
//char ch1[str.size()] = str;
//char ch1[] = str.c_str();
//char ch1[str.size()] = str.c_str();
In C++, you cannot do something like that. C style array must have a size determined at compile time and there is no way to initialise such an array from a string other than a C-style string defined in code.
Here is a much better alternative if you need to modify the content. If not, then simply use string operator [] or the result of c_str().
std::string str = "123456789";
std::vector<char> ch1(str.begin(), str.end());