Home Segments Top Top Previous Next

508: Mainline

To declare a variable with an array as that variable's type, you add brackets to an ordinary variable declaration. For example, to declare durations to be a variable to which an integer array will be assigned, you write the following:

  *-- Declare a variable 
  | 
  |            *-- An array is to be assigned to the variable 
  |            v 
  v           --- 
----------------- 
int durations [ ];