Help understanding multidimensional array and pointer notation in c++ -
I understand the basic idea that when an array is the only operam & amp; Or sizeof () operator, it decays an indicator for the first element in the array. I am unsure about how these notations work. In our lessons, there are 1-D cases, 3-D cases versus an array The first example is the function for the function, which is called normal. 1-D case
Double average (double set []) or double average (double * set)
Not equal multi-d case Announcement
Double average [] [DIM1] [DIM2]) or double average (double (* set) [DIM1] [DIM2])
< Similarly, the function declaration for printing a value for 1-D:< P> D is the case:double * print value (double value)
Double (* print value (double value) [DIM1] [DIM2]
Does anyone have any questions on this Can you put light? Thank you.
parameter still decays important for an indicator is that the size of DIM 1 and DIM2 all Specify, but one dimension Therefore, if we have:
Double average (double set [] [DIM1] [DIM2] MySet)
MySset [0] [0] Together with DIM2 * size (double) MySet [0] [1], two dimensions say that mileage [1] before mileage [0] is DIM 1 * DIM2 * size (double) I left you And a DIM0 is not required, because the number of rows does not affect indicative arithmetic. You can always leave the left dimension for this reason.
Comments
Post a Comment