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.
Asked
Active
Viewed 59 times
0
-
If you could provide an example type for the two cases, I may understand your question. – Neil Kirk Aug 07 '13 at 01:50
-
Check out this link: http://stackoverflow.com/questions/1242705/performance-of-2-dimensional-array-vs-1-dimensional-array I hope this is what you want. – Eldar Agalarov Aug 07 '13 at 01:54
-
give me example pleace – user2097374 Aug 07 '13 at 02:04
1 Answers
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