-
Initializing 2D Vector?
Hi forum!
I wonder how can I a initialize a 255x255 Square Matrix ?
I thought that Using a Vector should be the easy approach, but how can I initialize them?
I have:
Code:
Vector < Vector <int> > matrix2d; //this should be initialized as 255x255 2D vector
and offcourse when I do something like matrix[j][i] = 123;
I get a EXEC_BAD_ADDRESS!.
Any help is very appreciated!
thanks.
-
It should be something like this:
Code:
std::vector<std::vector<int> > matrix2d(255, std::vector<int>(255));
-