Skip to content

Instantly share code, notes, and snippets.

@Tevinthuku
Created December 1, 2016 16:03
Show Gist options
  • Save Tevinthuku/1750f3329438dde69997967ce82ecfe0 to your computer and use it in GitHub Desktop.
Save Tevinthuku/1750f3329438dde69997967ce82ecfe0 to your computer and use it in GitHub Desktop.
// Arrays
// datatypeofarray arrayname[numberofitems];
int Numbers[7];
// in this array we have the following elements
int Numbers[7];
- Numbers[0]
- Numbers[1]
- Numbers[2]
- Numbers[3]
- Numbers[4]
- Numbers[5]
- Numbers[6]
//it doesn't go up to Numbers[7] because we start indexing from [0]
Numbers[0].setNumber();
Numbers[1].setNumber();
//coding for each element in the array is tedious
//that is why we use loops to iterate through the items of the array
// 0<=n<7
//n starts from 0 and goes up to 6
//for loop
for (int n=0; n<7 n++) {
Numbers[n].setNumber();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment