What do you suppose is the value of the arithmetic expression:
data + data
data contains a 14 and
data contains a 9, the sum is 23.
An expression such as
data is called
a subscripted variable.
A subscripted variable can be used anywhere an ordinary
variable of the same type can be used.
data contains an
can be used anywhere an
int variable may be used.
An arithmetic expression can contain a mix of literals,
variables, and subscripted variables.
For example, if
x contains a 10, then
(x + data) / 4
evaluates to (10+14) / 4 == 6. Here are some other legal statements:
data = (x + data) / 4 ; data = data + 1; x = data++ ; // the data in cell 3 is incremented data = data / data;
Assume that the array holds values as in the picture. What will be the result of executing the statement:
data = data + 8;