int main(void) { int i; int array[5]; for (i = 0; i <= 20; i++) array[i] = 0; return 0; }
Why is the above code stuck in a
The problem is when you try to access an element outside the bounds of the array, which is only 5 big - but in a loop that is 21 big.
int main(void) { int i; int array[5]; for (i = 0; i < 5; i++) array[i] = 0; return 0; }