Debian Codegraph @

examples/book/digital-artists/chapter3/Listing3.3.ck

raw
1 // Listing 3.3 Accessing (reading and writing) data in an array
2
3 // declare and initialize an array
4 [57, 57, 64, 64, 66, 66, 64] @=> int a[];
5
6 // array look up by index
7 a[2] => int myNote; // (1) Looks up note in array by integer index
8
9 // print it out to check
10 <<< myNote >>>; // (2) Prints it
11
12 // want to change data? no problem! (print too)
13 61 => a[2]; // (3) Changes array element value at index
14 <<< myNote, a[2] >>>;