int a[4][5][6][7];
a[1][2][3][4]=3;
a[3][2][1][0]=4;
a[2][2][4][4]=5;
a[2][3][5][0]=6;
Given that anint has a size of 4 bytes. Assume that a[0][0][0][0] is at the address of 2000. Find the address of
(i) a[1][2][3][4] if row major is used;
(ii)a[3][2][1][0] if row major is used;
(iii)a[2][2][4][4] if column major is used;
(iv) a[2][3][5][0] if column major is used.
ans:
(i) 1*5*6*7+2*6*7+3*7+4
(ii) 3*5*6*7+2*6*7+1*7+0
(iii) 2+2*4+4*4*5+4*4*5*6
(iv) 2+3*4+5*4*5*+0*4*5*6
完全唔知點計同個原理 求救
更新1:
唔係wow 點解你計出黎同我個model ans 完全唔同既?......