Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ array as parameter - why do you only need to specify "outer" dimension

Tags:

I'm trying to figure out multidimensional arrays and specifically how to fill them by passing them to functions. It's all very unintuitive, but the unintuitivest thing of all, which doesn't make any sense at all to me is:

Why do you have to specify the number of columns, but not the number of rows when passing an 2d array as a parameter? I've probably looked at five or more forum threads that give the syntax, but none of them explained the reasoning behind it. I am okay with the compiler needing to know the size of an array to operate on it, but isn't a bidimensional array basically an array of arrays?