Organizational Research By

Surprising Reserch Topic

array out of the index boundaries

array out of the index boundaries  using -'c'

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"
and Ok that is normal
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;


asked Sep 9, 2015 by AlvHone
0 votes

Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.