0

i read in (Learning OpenCV) topic about array of point and i dont understand difference between a multidimensional array (or matrix) of multidimensional objects and an array of one higher dimension that contains only one-dimensional objects.

1 Answers1

0

In C and C++, a multidimensional array is simply an array of arrays.

On the other hand, there are a lot of data structures that emulate multidimensional arrays using pointers to rows or pointers to elements. Depending on how the data structure is defined, you can use the same arr[x][y] syntax to access the elements. Array indexing is defined in terms of pointer arithmetic, and in the common case where the prefix is the name of an array object, the name is implicitly converted to a pointer; if the prefix is already a pointer no conversion is done.

Recommended reading: Section 6 of the comp.lang.c FAQ.

(In C++, it's generally easier to use container classes rather than C-style arrays.)

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631