In the following code, I've assigned values to an array elements which are out of the array boundaries, In Linux environment in the CLI the code give me the error message: array index 5 is past the end of the array which contains 5 elements
.
But while debugging on IDE codeblocks -compiler cannot find this bug- so is there any explanation?
#include <stdio.h>
int main ()
{
int array[5],i;
for (i=0; i<5; i++) {
array[i] = i+1;
}
array[5] = 666;
for (i=0; i<5; i++) {
printf("array[%d]=%d\n", i, array[i]);
}
printf("array[5]=%d\n", array[5]);
return 0;
}