Thomas (boggyb) wrote,

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++)"...

  • NaBloPoMo!

    It's November, which means it's time for anther month of semi-coherent ramblings! Ironically, despite the current Covid insanity today was much like…

  • NaBloPoMo!

    Yes, it's that time of year where I try to create an entire month's worth of random ramblings! Today ended with a surprise games evening, courtesy…

  • NaBloPoMo result

    Well, another year, another November of trying to think of some random insanity to post every day. This year was less successful that past ones, in…

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.