Directions given: Write a function int getLength(int grid[][6]) that computes the number of elements contained within the 2-D array.
My first question is: How do we pass an array into a function? I get an error when I try to do that.
int x[][2] = {{ 1, 2 }, { 2, 3 }};
int getLength(x);
Error: a value of type "int (*)[2]" cannot be used to initialize an entity of type "int"
============================================================
Also, is this as simple as just using sizeof() like so?:
int getLength(int grid[][6]){
cout << sizeof(grid);
return sizeof(grid);
}