+ 3

This array representation is new to me what that means a colon between two values?

For given array Z[-4:-1, 10:13, -1:1] find the total number of elements. Assume that the base address is 5001 and each element required 2 bytes. Find address of Z[-2,12,0] element if it is stored in (a) row major order (b) column major.

7th Jan 2020, 9:49 AM
Piyush Srivastava
Piyush Srivastava - avatar
1 ответ
+ 2
Never seen that representation before, but I have a guess. Some languages allow a non-zero/non-one based array. Likely, that is what is specified. Z[-4, 10, -1] to [-1, 13, 1] for 48 elements. -4 to -1 for 4, 10 to 13 for 4, -1 to 1 for 3 so 4*4*3 or 48. You need to find row major order or -4:-1 first and -1:1 last. Column major order is -1:1 first and -4:-1 last.
7th Jan 2020, 11:20 PM
John Wells
John Wells - avatar