I have an array ex:
int array[3][5];
If I want to assign a value to an element in that array, it's simple... ex:
array[1][2] = 8;
However, I want to represent it in a pointer math, would this be correct?
**(array + 5 * 1 + 2) = 8;
In both cases it's looking for the 7th position... I'm just not sure if I need to include the 2nd * outside of (code)
**(code)
EDIT: Just a bit of a follow up. Thank you to everyone who was helping me with this. The confusion that I had came from a mistake in instructor's notes, and after I presented the information you've provided he realized the mistake and agrees that
*(*(array+row)+col)
or
*(*array+MAX_COL*row+col)
is the accurate pointer math representation for a two-dimensional array.
The **(array+MAX_COL*row+col)
is like array[MAX_COL*row+col]
, which is used in single dimensional array implementation of multidimensional array, just like James Kanze mentioned in one of the replies to this post (the second one is faster than the first one).