not working:
// range for
for (int (*row)[4] : ia) {
for (int col : *row)
cout << col << " ";
cout << endl;
}
// error: cannot convert 'int*' to 'int (*)[4]' in initialization.
working:
// range for
for (int (&row)[4] : ia) {
for (int col : row)
cout << col << " ";
cout << endl;
}
yet, i thought either code is similar, either i confused about how pointer works / how range for iteration works. either way, the first code produce type error which should not be there if the second code is working. :/