Skip to content

    1-35 Going outside array bounds

    Created by
    dwharder
    dwharder

    This code demonstrates what can happen if a programmer goes out of bounds in an array allocation. The local variables 'm' and 'n' are declared before and after, respectively, the declaration of an array of capacity 10, so that accessing array[10] accesses the same memory location as 'm' and accessing array[-1] accesses the same memory location as 'n' (and vice versa).