Hello
This page is for testing github pages and will be used for only that purpose.
- Use auto& if you need a reference of the element. Changing the value will change the original vector.
for(auto& i: vec){
std::cout << "from vec: " << i << endl;
i = 5;
std::cout << "modified as: " << i << endl;
}
//Now printing the original vector
for (auto i: vec){
std::cout << i << endl;
}
//Will print all 5 now as we changed the value
That’s it folks :simple_smile: