Last active
November 9, 2019 12:51
-
-
Save Ben1980/294e99c13124aa8517c0d1076bdbdb1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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