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

  • Achievement unlocked: jump-starting my car!

    Headed out to sainsbury's just now - or tried to, only to discover that my car's battery had run down over the past week and just did not want to…

  • Pancakes!

    Since people have been prodding me for an update, here's a pancake-themed one (as everyone's blogging about pancakes today!). Unlike in the linked…

  • More upgrades!

    For about a year and a half now I've been planning an upgrade to my desktop, Nyx. It currently runs a Core 2 Quad Q6600 so an upgrade is a little…

  • 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.