Answer

Nothing special happens. If you access outside of the bounds of an array, C will happily access something--you don't know what--somewhere in memory. If you write outside of the bounds of an array, C will happily write something somewhere in memory--you don't know where. Your program may appear to work properly, it may work incorrectly, or it may crash completely. Bugs like this are often quite hard to find, so be careful that all of your array accesses are legal.

Return to lesson.