Home Segments Index Top Previous Next

386: Mainline

To write into the oil_tanks array in the first place, you can use assignment statements in which the array name, a bracketed integer index, and the member-variable name appear on the left side:

 *-- Array's name 
 | 
 |         *-- Array's index      
 |         | 
 |         |        *-- Member-variable name 
 |         |        | 
 |         |        |       *-- Value to be stored 
 |         |        |       | 
 v         v        v       v 
oil_tanks[counter].radius = 8; 

To read data from the oil_tanks array, once the data have been inserted, you simply write an expression containing the array name, a bracketed integer index, and the member-variable name. The following expression, for example, yields the radius of the cylinder stored in the place indexed by the value of counter:

oil_tanks[counter].radius