C++ Array of Variable sized Arrays
- by adam
I am very new to C++ and I realise the following is not necessarily as easy as I'd like it to be, but I'd really appreciate a more expert opinion.
I am essentially trying to achieve a dynamic iteration over a variable sized array of variable sized arrays similar to the following.
String *2d_array[][] = {{"A1","A2"},{"B1","B2","B3"},{"C1"}};
for (int i=0; i<2d_array.length; i++) {
for (int j=0; j<2d_array[i].length; j++) {
print(2d_array[i][j]);
}
}
Is there a reasonable way to do this? Perhaps by using a vector, or another struct?
Thanks :)