Question: How do I extract a character from a string that is an array?
Explained: Normal strings
string example=("Stack Over Flow");
cout<<example[1];
The output will be:
t
What I want is to extract a letter from an array of strings example:
string str[4];
str[0]="1st";
str[1]="2nd";
str[2]="3rd";
str[3]="4th";
cout<<str[2];
will print
3rd
how could i get the "t" from the str[0]?
string example=("Stack Over Flow");is not an array.std::stringobject, and e.g.str[0]is astd::stringobject.