I seem to be having a problem where my compiler does not properly give me an exception when I access an index that is out of the bounds of the array.
For example: in my code I have
int reds[8][8];
This should create a 2d array with height 8(0-7) and width 8(0-7). The problem is, I have the following lines of code hereafter:
reds[0][8] = 1;
reds[0][65] = 1;
And my code compiles fine with no error. However, my program obviously does not work the way I want.
if(reds[r][column] > 0){
if(column == 0) Red1_Write(0);
if(column == 1) Red2_Write(0);
if(column == 2) Red3_Write(0);
if(column == 3) Red4_Write(0);
the if statement is gone into every time when it shouldnt. the values of the array at column 1 to 3 at row 0 was set to zero. What am I doing wrong?