Multi dimensional array index bug
-
Not at all an expert on these but the inconsistancy makes me think it is a bug.
array zig[3]
zig[3] = 6Creates an array of 4 integers. 0,1,2,3
With multi dimension it only creates 3 integers 0,1,2
array zig[3][0]
zig[3][0] = 6Error "Attempted to index non-array type"
If I create 4. I now have access to 3. Following code works
array zig[4][0]
zig[3][0] = 6 -
Part of me thinks the first bit is a bug and part of me thinks the second part is the bug
array[5] should be 0-4, no question
Someone will know the answer to this in the office. I'll try to find out!
-
To be honest, the whole assigning 0 to a dimension on creation just confuses me. It's one thing to use 0 when reading/writing to an array because of it being base-0, but on creation, it's base-1, as using 0 I would think would cause it to make a non-element array. There's the whole array-expansion bit by assigning data to an out-of-bounds element though.