The only difference between the following two snippets of code is the usage of reference. I understand why the first snippet does not compile and am seeking help in understanding why the second one compiles.
The first snippet:
int a[2][3] = {0,1,2,3,4,5};
for (auto row : a)
for (auto column : row)
cout << column << endl;
The above code does not compile because the type of 'row' is pointer to int, which is not a sequence.
The second snippet:
int a[2][3] = {0,1,2,3,4,5};
for (auto &row : a)
for (auto column : row)
cout << column << endl;
This code compiles. If I understand correctly how auto works, 'row' is a reference to pointer to int. But why can this reference be viewed as a sequence more than a regular pointer?