I understand C++ passes arrays by reference even if we don't use the reference operator (&), but since it can be added with no harm (I think), I'm curious as to why this code throws
declaration of 'matrix' as array of references
void function (int &matrix[2][5]) {
//something
}
int main() {
int matrix[2][3] = {{1,2,3}, {4,5,6}};
function(matrix);
}
while adding parentheses in (&matrix)
works:
void function (int (&matrix)[2][5]) {
//something
}