0

I am new in C++ and I am sorry if this is a dumb question. My question is very simple someone please tell me how can I convert a string to character array?

fuz
  • 76,641
  • 24
  • 165
  • 316

1 Answers1

0

As per my knowledge you can simply call c_str method see the below code:

string test = "test string";
cout << "I am printing the first index of the character array" << test.c_str()[0];

Try this and let me know in case of any problem.