foreach loop in 2D Arrays in C++
Just use auto
keyword
int myArray[3][3];
for(auto& rows: myArray) // Iterating over rows
{
for(auto& elem: rows)
{
// do some stuff
}
}
Just use auto
keyword
int myArray[3][3];
for(auto& rows: myArray) // Iterating over rows
{
for(auto& elem: rows)
{
// do some stuff
}
}