2-dimensional array of longs and memory issues

tuxduino:

int values[3];    // array declaration: N = number of elements

value[0] = 40;    // first element has index 0
value[1] = 10;
value[2] = 99;    // last element has index N - 1

value[3] = 100;   // <==  memory corruption

Yes, exactly, and this is, as I understand it, the only thing which could cause a problem here - if I try to assign or read from an index above what is actually allocated, but I'm simply not doing that anywhere in my code! I've allocated an array of 8 units, and I'm not referencing anything above index number 7 at any point. That's why I'm so puzzled that this array somehow causes corruption in my code unless I assign an extra slot for it - an extra slot that I never use.

Oh well, I just thought that maybe there was some sort of common newbie mistake I might be doing here that I wasn't aware of, but apparently not, thanks anyway.