# include int main ( ) { int a[5] = { 10, 20, 30, 40, 50 }; int b[5] = { 110, 120, 130, 140, 150 }; int c = 999; int d = 123; int e[5] = { 210, 220, 230, 240, 250 }; int i; int f; // // Because B has dimension 10, the array B can be indexed by 0 through 9. // You might expect that you would get an error if you wrote an expression // like B[-1] or B[12]. // // Let's see. // // If you think about the fact that C will let you say B[12], it makes // sense to think that "B" is a place in memory, where B[0] is stored, // and that B[1] simply means 1 memory location later, but B[-1] means // one memory location sooner. // printf ( "\n" ); printf ( "Legal entries of B:\n" ); printf ( "\n" ); for ( i = 0; i < 5; i++ ) { printf ( "b[%2d] = %3d\n", i, b[i] ); } printf ( "\n" ); printf ( "What happens if we go too far?\n" ); printf ( "\n" ); for ( i = 5; i < 18; i++ ) { printf ( "b[%2d] = %3d\n", i, b[i] ); } printf ( "\n" ); printf ( "What happens if we go the other way?\n" ); printf ( "\n" ); for ( i = -1; -10 <= i; i-- ) { printf ( "b[%2d] = %3d\n", i, b[i] ); } return 0; }