[sword-devel] VerseKey.java
Bobby Nations
sword-devel@crosswire.org
Tue, 25 Dec 2001 21:59:47 -0600
Guys,
Ok, I'm having a bit of trouble understanding some of the C++ code in
versekey.cpp. On line 39, the variable 'offsets' is defined as a two
dimensional array like so:
long *VerseKey::offsets[2][2] = {{VerseKey::otbks,
VerseKey::otcps}, {VerseKey::ntbks, VerseKey::ntcps}};
But, here's where I'm having trouble comprehending, everywhere that it's
used, it's called as if it has three dimensions! For example, lines
1240 and 1241 read.
offset = offsets[testament-1][0][book];
offset = offsets[testament-1][1][(int)offset + chapter];
Now the code compiles and links correctly, but I don't understand why
that is so? Please help me to understand how a two dimensional array is
allowed to be accessed as if it were three dimensional so that I can
finish converting the versekey.cpp file to Java for JSword.
Thanks,
Bobby