Multidimensionals Arrays indirect interaction -
i've extracted problem, don't understand why cout << array[0][8] writes 2 instead of 1.
http://gyazo.com/d159d3ea97b07f1551605daacd631703
#include <iostream> using namespace std; int main() { int array[8][8]; array[0][8] = 1; array[1][0] = 2; cout << array[0][8] << endl; system("pause"); return(0); }
i think array assigned type:
an element in 2-dimensional array accessed using subscripts, i.e., row index , column index of array. example:
type arrayname [ x ][ y ];
where type can valid c++ data type , arrayname valid c++ identifier.
a two-dimensional array can think table, have x number of rows , y number of columns. 2-dimensional array a, contains 3 rows , 4 columns can shown below:
thus, every element in array identified element name of form a[ ][ j ], name of array, , , j subscripts uniquely identify each element in a.
int val = a[2][3];
Comments
Post a Comment