CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

use in expressions

you can have arrays of anything;

  • first element has index 0
  • do not use beyond last element.

to denote one element use the array name and the index inside brackets: Guy[7] ... Guy[k-3] ... number[3*i-2]

note: Guy ... is an array; Guy[7] is one athlete!

elements of a numeric array can be used in expressions:
void mainprog()
{
int value[10]; //declares an array of 10 integers
for (int index=0;index<=9; index++)
{
value [index]=9-index;// compute value for each element
}
...
}