Okay, so I was teaching my girlfriend some c++, and she wrote a program that I thought wouldn\'t work, but it did. It accesses one more element in the array then there is (f
The stack is very large. On Windows, it's 1 MB.
Since the program doesn't do much, the array would have been allocated close to the beginning of the stack. This means there would be almost 1 MB of empty space between the end of the array and the end of the stack.
So what does this mean? When you write past the end of the array, you're just clobbering your own stack space, not other programs', so the OS doesn't stop you and the program continues to run.