CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

How many elements?

The array must be declared with the maximum number of elements you expect to use.

The size cannot be expressed as a variable!

int number_of_students;
...
int student_age[100];
int sum=0;
float average;
 for (int i=0; i<number_of_students; i++)
{
sum=sum+student_age[i];
}