Doubt regarding address calculation in two-dimensional arrays I am reading about the address calculation formulas for one and two-dimensional arrays.             I have two related doubts concerning it.

In one of the problems, we are asked to calculate the location of B [1700] for an array B [1300....1900].
Now, I understand that B [1700] is actually the 401th element in the array (correct?), so we can calculate its address. 

But in another problem, we are given an array X [-15....10,15.....40] and are asked to determine the location of X [15][20] but I don't see how it is even a part of the array since the "row" subscript(i.e. 15) is not contained in (-15....10). (According to me the last element of this array is X [10][40]).

My second doubt is: In another question, we are given the array M[-3......18,-8......7] (stored column-wise where width of element = 8 bytes) and are asked to calculate the base address given that the address of element M [5][10]=4000.

The solution proceeds as -  


  M [5][10] = BA + W*(M*(j-Lc)+(i-Lr)) therefore, M [5][10]=4000 + 8*(22*(10-0)+(5-0))


i.e. my book answer takes Lc = 0 &amp; Lr = 0 but I think it should be Lc = -8 and Lr = -3? So, which is it? 
Also can I write a program in which I can verify this for myself (specifically, how can I declare an array in c++ whose subscript doesn't start at 0?)?
Thank you so much.
For the first question, you can calculate an address for it -- languages that don't do array bounds checking will gladly calculate an address and read/write there, even if it is out of bounds.  Of course, if the program is accessing an out-of-bounds element, that's typically a bug of some sort.

For your second question, you are right.

You probably won't run into arrays that start at an index other than 0 in practice very often (if ever), so I wouldn't worry too much about it.  Your understanding seems solid.