In the declaration of n, notice that the variable name is followed by the number 10 in square brackets. This signifies that n is an array of 10 elements. Each array element is a unique storage location inside the array, just like an ordinary variable. This means that by just writing:

  int n[10];

we've effectively declared ten variables, named n[0] through n[9].

Return to lesson.

Eric N. Eide
Hamlet Project
Department of Computer Science
University of Utah