I'm trying to input a sequence of words using character array. I don't want to use string from STL. Where am I going wrong?
int n;
cout<<"Enter the number of words:";
cin>>n;
char **s = new char*[n];
for(int i=0;i<n;i++)
{
char *s = new char[10];
cin>>s[i];
}
std::vectorinstead of managing the memory yourself. Something likestd::vector<std::vector<char>>(n, std::vector<char>(10)). If you are storing stringsstd::vector<std::vector<std::string>>(n)I don't want to use string from STLAny reason why?Just beacuse I want to learn how it would work with charSo if you want to learn, look at the thousands of examples of properly coded dynamic array classes right here on SO and other sites. No need to throw together non-working code and wonder what to do next.