Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <iostream>
#include <vector>
void print(const std::vector<std::vector<int>> &vec) {
std::cout << "sizeof(int): " << sizeof(int) << '\n';
std::cout << "sizeof(std::vector<int>(10)): " << sizeof(std::vector<int>(10)) << '\n';
for(const auto & r : vec) {
std::cout << "Row address: " << &(r) << '\n';
for(const auto & c : r) {
std::cout << &(c) << ", ";
}
std::cout << '\n';
}
std::cout << std::endl;
}
int main() {
std::vector<std::vector<int>> vec = { {0,1,2,3,4,5,6,7,8,9,10},
{0,1,2,3,4,5,6,7,8,9,10},
{0,1,2,3,4,5,6,7,8,9,10} };
print(vec);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.