
button input. An integer array DICE_ARRAY is created to store the
hexadecimal bit patterns as described in the table. Index 0 of this array
corresponds to dice number 1 (pattern generated by hexadecimal number 8)
and index 1 corresponds to dice number 2 (pattern generated by hexadecimal
number 14) and so on. Because the arrays in C are indexed from 0, we have to
subtract 1 from the array index in order to get the correct value. As shown in
the program listing in Fig. 3.12, variable button is tested inside the endless loop.
If the push-button is pressed, the hexadecimal bit pattern corresponding to
variable DICE-1 is obtained using the statement DICE_ARRAY[D ...