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.
-
If you could provide an example type for the two cases, I may understand your question.Neil Kirk– Neil Kirk2013-08-07 01:50:23 +00:00Commented Aug 7, 2013 at 1:50
-
Check out this link: stackoverflow.com/questions/1242705/… I hope this is what you want.Eldar– Eldar2013-08-07 01:54:40 +00:00Commented Aug 7, 2013 at 1:54
-
give me example pleaceuser2097374– user20973742013-08-07 02:04:38 +00:00Commented Aug 7, 2013 at 2:04
1 Answer
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.)