Electrical and Computer Engineering
7 of 17
UAH
CPE 112
Examples of Declaring and
Accessing Arrays
•const int BUILDING_SIZE = 350;
•int occupants[BUILDING_SIZE];
•int totalOccupants;
•int counter;
•totalOccupants = 0;
•for (counter = 0; counter < BUILDING_SIZE; counter++)
• totalOccupants = totalOccupants + occupants[counter];
•
•