why .... :(

Jul 31, 2012 at 5:35am
guys ...

void test ( int ary[][3] ) ;

why I must determine the numbers of columns in this header of function test ???
Jul 31, 2012 at 7:04am
when we pass an array the compiler needs to know the size of its elements, not how many elements it has.
A two-dimensional array can be thought of as a one-dimensional array of elements (which just happen to be arrays themselves).
Thus the compiler needs to know the size of one of the elements.
Each element is a row of values so the compiler needs to know the type of elements and how many values (the number of columns) are in each row.
Jul 31, 2012 at 7:24am
closed account (o3hC5Di1)
Hi there,

For a more in detail explanation of what Mr. Vaghani explained, have a look at: http://cplusplus.com/faq/sequences/

All the best,
NwN
Topic archived. No new replies allowed.