Answer

To access an array element, you simply write the index of the desired element in square brackets after the array name. You can use an indexed array name just like any other variable. In the program, we twice reference n[i], for different values of i. Notice how nicely arrays go together with for loops.

Return to lesson.



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