How can I use matrix strings

Hi People!

I have a problem with strings.
I would like to declare a string as:

String text[]={"asd", "cdf",
"bgh", "qwe"};

From this I would like to get a matrix via I can do this:

cout << text[0][0];

and I get "asd" and not "a".
Is it possible?

Thank you for your help:)
text[0] will get the first element of the array text, "asd". text[0][0] will get the first element of the first element of the array text, 'a'. So what you are looking for is text[0].
asd cdf
bgh qwe
I want this to be a 2x2 array
And i can call the elements like: cout << text[0][0]
1
2
3
4
5
std::vector<std::vector<std::string>> text =
{
    {"asd", "cdf"},
    {"bgh", "qwe"}
};
closed account (48T7M4Gy)
A cumbersome array arrangement

1
2
string text[][2] = { { "asd", "cdf" }, { "bgh", "qwe" } };
cout << text[0][0] << text[1][1];
Thank you!
Topic archived. No new replies allowed.