I'm having trouble with accessing elements of the last vector that is contained within a vector.
std::vector<std::vector<int>> vec1 = {{1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}}.
How to get the second element of the last element of vec1
?
I try:
vec1.[vec1.end() - 1][1]
vec1.[vec1.at(vec1.end()) - 1][1]
How can I use at when there are 2 dimensions?
please explain the use of []
and .at()
.