HI ,
I am trying to convert string into char array of characters.but facing problem.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string t="1,2,3,4,5,6";
char cc[strlen(t)]=t;
cout<<cc[1]<<endl;
return 0;
}
df.cpp:8: error: cannot convert ‘std::string’ to ‘const char*’ for argument ‘1’ to ‘size_t strlen(const char*)’
df.cpp:8: error: cannot convert ‘std::string’ to ‘const char*’ for argument ‘1’ to ‘size_t strlen(const char*)’
Please Help me out of this pblm .I will be thankful to you.