C++
Programming and Technical
Represent a two-dimensional array using pointer?
Read Solution (Total 3)
-
- 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. - 10 years agoHelpfull: Yes(0) No(0)
- array[1][2] equals *( *(array + 1) + 2).
//formula- *(*array+MAX_COL*row+col) - 9 years agoHelpfull: Yes(0) No(0)
- int array[2][3] can be represent by pointer is int (*ptr)[3];
- 8 years agoHelpfull: Yes(0) No(0)
C++ Other Question