torkell: (Default)
Thomas ([personal profile] torkell) wrote2006-05-17 12:07 pm

(no subject)

Pop quiz: what happens when you try to write beyond the end of an array?

Well, in Java the runtime quite rightly throws an ArrayIndexOutOfBoundsException.
In VB 6, assuming you've not disabled array bounds checks you'll get an error rasied.
In C, it'll happily let you scribble over whatever was after the array. Which in this case happened to be the loop variables. No prizes for guessing what happens when i is set to 0 in a loop that goes "for (i=0;i<foo;i++)"...

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting