In this lesson we're gonna see how we can work 
with arrays. We're gonna do a lot of traversals 
and this is going to point out
a very important fact about arrays. Again, the 
memory is contiguous which means we can 
index through
the data and what is most suited for this, of 
course is a loop and a counting loop. The four 
statement. You'll see
the for statement being used multiple times to 
traverse arrays for various tasks. We're going to 
began with a traversal simply to read in
some information from users. We've declared a 
constant "size",
to be five, an array of "ages" of size five and 
initialize them all to zero. We have a sum, an 
average we set to zero and then a for loop
that's going to traverse the array. Now, again 
remember that the indices on the array run from
zero to "size" -1.This is extremely important! 
Look at the for loop.
We start our index at zero and go up to, but not 
including "size". This is extremely important. And, 
again
I want to point out the utility of declaring that "size" 
is a constant. Suppose that I don't have five 
people but 50 people I can change it in one spot
and everything changes the declaration and the 
traversal changed
and no other change has to take place. It's very 
simple.
Let's run through this. With "i" equal to zero, I'm 
going to look at the 0th
element. I will prompt for and to enter an age for 
the first person. That is going to be 12.
Increment to one, read in 15, increment to two: 
31, increment to three: 18, increment to four and 
enter 14.
So I've run through the array completely, from "i"  
equal to zero to "i" equal to four, which is less 
than size.
As soon as I go up to five, I'm no longer less than 
size and I'm out of that loop. Second traversal, 
same array, again a for loop, I'm going to go from
zero up to, but not including "size" is extremely 
important, so I'm traversing the array from the 0th 
the 4th element,
I'm going to sum up the ages. So, for "i" equal to 
zero, I have sum is zero. I'm gonna add in 12, 
add in 15, add in 31, add in
18, add in 14, and my sum is 90 and I calculate 
the average to be
90 divided by 5 is 18, and output that.
For our third traversal, I'm going to find the 
maximum value in the array. What I'll do is,
I'm gonna write this code to emulate the way I 
would do it if I was a human being.
And this is what you wanna do quite often with 
your code.
Take a look at what you do. Remember what we 
did in the first lesson? We looked at algorithms.
If I give you this array and ask you, find the 
maximum value,
what do you do? Well, you look at the first 
elements and say, this is the biggest one so far 
and hold on that, you look at the second,
15 okay, that's bigger, I'm going to replace that 12. 
31. Ah, that's bigger, that's now the biggest one. 
18, no, that's not bigger. 14, no that's not bigger.
31 that was the biggest one I remember. What 
you did was you held on to each item as you went 
and if you found something that was bigger,
you replaced it. That is exactly what your code is 
going to do. You have to slow down your thinking 
process and write code that emulates that
process. So, look at our for statement here. 
We're gonna start at "i" equal to 1 now. Why 1? 
Well, because I set my maximum to be
ages zero. The very first element, I don't need to 
look at it. So I'm going to start at one, and go up 
to, but not including "size" again.
If I went up to & included "size", then I'd be looking 
at memory out here that that's not mine. So, for 
"i" equal to 1, is "ages[1]" bigger than "max"?
Yes it is, so I'm going to assign it to "max". 
Increment to 2. I ask the question: is it bigger? 
Yes, so assign it.
To 3. Is "ages[3]" bigger than "max"? The answer 
is, no. Go to 4, is it bigger? No, and I'm done. I 
output
what the max of the array is.
For our next traversal of this very same array, I'm 
going to sort it.
This is actually a coding of the sorting algorithm 
we know as bubble sort.
Alright? It is a loop inside of a loop. A for loop 
inside of a for loop. The outer loop
names how many times I'm actually going to 
traverse the data. The inner loop
